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); }}
输出:

问问小宇宙
问问小宇宙是小宇宙团队出品的播客AI检索工具
77 查看详情
以上就是日问2的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/366270.html
微信扫一扫
支付宝扫一扫