public class text { public static void main(String[] args) { People people=new People("liu",12); people.info(); } class People{ public String Name; public double Age; public People(String name,double age){ Name=name; Age=age; } public String getname(String username){ return username; } public double getage(double userage){ return userage; } public void info(){ System.out.println("我是"+getname(Name)+"。今年"+getage(Age)+"岁"); } } }错因如下:Exception in thread "main" java.lang.Error: Unresolved compilation problems: The constructor text.People(String, String) is undefined The method Age() is undefined for the type text.People at text.main(text.java:8)
添加回答
举报
0/150
提交
取消