class PlayGround
{
int score,balls,catches;
String player_name;
public PlayGround(String player_name,int score,int catches)
{
this.score = score;
this.player_name = player_name;
this.catches = catches;
}
public PlayGround(String player_name,int score,int catches,int balls)
{
this.score = score;
this.balls = balls;
this.catches = catches;
this.player_name = player_name;
}
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);
}
public void allrounder()
{
System.out.println(player_name + " " + balls + " " + score + " " + catches);
}
}
输出:

以上就是日问2的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号