DEV Community

Harish R
Harish R

Posted on

Today task (playground) day 2

class Playground1
{
int score,ball,out,run;
String name;
public Playground1(String name,int run,int out,int ball)
{
this.name=name;
this.out=out;
this.ball=ball;
this.run=run;
}
public Playground1(String name,int run,int out)
{

this.name=name;
this.run=run;
this.out=out;

}
public  static void main(String[] args)
{
Playground1 player1=new Playground1("doni",100,3);
Playground1 player2=new Playground1("jadeja",56,2,30);
player1.batting();
player2.allrounder();
}
public void batting()
{
System.out.println(score);
System.out.println(name);
}
public void allrounder()
{
System.out.println(ball);
System.out.println(out);
System.out.println(run);
System.out.println(name);
}
}

output:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sm4ho1ejoesn2z5a1rky.png)


Enter fullscreen mode Exit fullscreen mode

Top comments (0)