为了账号安全,请及时绑定邮箱和手机立即绑定

Java构造函数,代码及错因如下,求大神指点

Java构造函数,代码及错因如下,求大神指点

慕盖茨2165817 2017-01-26 11:59:15
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 回答
  • 0 关注
  • 1332 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信