DEV Community

yaswanth krishna
yaswanth krishna

Posted on

2

java task


class Playground
{
int score,balls,catches;
String player_name;

public Playground(String player_name,int score,int catches)
{
this.player_name=player_name;
this.score=score;
this.catches=catches;
}
public Playground(String player_name,int score,int catches,int balls)
{
this.player_name=player_name;
this.score=score;
this.catches=catches;
this.balls=balls;
}
public static void main(String[] args)
{
Playground player1 = new Playground("dhoni", 100, 3); 
Playground player2 = new Playground("jadeja", 56, 2, 30); 
player1.batting();
player2.allrounder();
}
public void batting()
{
    System.out.println(player_name+"  " + score +" "+ catches);
}
public void allrounder()
{
    System.out.println(player_name+" "+ score+" "+catches+" "+balls);
}
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post