Create non-static variables as below.
int score, balls, catches;
String player_name;
Create main method.
Inside main method, create two instances as below.
PlayGround player1 = new PlayGround("dhoni", 100, 3);
PlayGround player2 = new PlayGround("jadeja", 56, 2, 30);
Create appropriate constructors for handling above objects.
Using player1 object, call batting() method. Print - score, player_name.
Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.
Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.
Top comments (0)