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.
Top comments (0)