class PlayGround
{
int score, balls, catches;
String player_name;
public PlayGround(String player_name, int score)
{
this.player_name = player_name;
this.score = score;
}
public PlayGround(String player_name, int score,int balls,int catches)
{
this.player_name = player_name;
this.score = score;
this.balls = balls;
this.catches = catches;
}
public static void main(String[] args)
{
PlayGround player1 = new PlayGround("dhoni", 100);
PlayGround player2 = new PlayGround("jadeja", 56, 2, 30);
player1.batting();
player2.allrounder();
}
public void batting()
{
System.out.println(player_name+score);
}
public void allrounder()
{
System.out.println(player_name+" "+ score+" "+balls+" "+catches);
}
}
Top comments (0)