java 中无法将类 中的构造器 应用到给定类型
classNoname3{publicstaticvoidmain(String[]args){Childch1=newChild(3,"大大");ch1.joinGam...
class Noname3{ public static void main(String[] args) { Child ch1 = new Child(3,"大大"); ch1.joinGame(); Child ch2 = new Child(4,"小小"); ch2.joinGame(); System.out.print("一共有"); }}
class Child { int age; String name; static int total=0; public void Child(int age,String name) { this.age =age; this.name =name;
} public void joinGame() { total++; System.out.println("999"); }
} 展开
class Child { int age; String name; static int total=0; public void Child(int age,String name) { this.age =age; this.name =name;
} public void joinGame() { total++; System.out.println("999"); }
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询