输入:
班级游乐场
{
得分、球数、接球数;
字符串玩家名称;
公共游乐场(字符串玩家名称,int分数,int捕获量)
{
this.score = 分数;
this.player_name =player_name;
this.catchs = 捕获;
}
公共游乐场(字符串玩家名称,int分数,int接球数,int球数)
{
this.score = 分数;
this.player_name =player_name;
this.balls = 球;
this.catchs = 捕获;
}
public static void main(String[] args)
{
游乐场player1 = new Playground("dhoni",100,3);
游乐场player2 = new Playground("jadeja",56,2,30);
player1.b
atting();
player2.allround();
}
公共无效击球()
{
System.out.println(玩家名 " " 分数 " " 捕获数);
}
public void allround()
{
System.out.println(player_name " " score " " balls " " catchs);
}
}
输出: