DEV Community

hema latha
hema latha

Posted on

Player dhoni task

  1. Create a class Called Player
  2. Have main method in it.
  3. Inside main method, create an instance(object) called 'dhoni'.
  4. Using 'dhoni' reference, call a method called 'batting(30)'
  5. From batting, return 100
  6. Store returned value as score.
  7. Print returned value in main method.

package terminaltask;

public class Player {
public static void main(String[] args) {
Player dhoni = new Player();
int score = dhoni.batting(30);
System.out.println(score);

}
public int batting(int run)
{
return 100;
}
}
out put 100

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more