正确的方法getAge()下列错误定义为什么我不能从Java中的void函数返回值?
public void getAge()
{
return age;
}
在这里你的答案贴:
public int getAge(int age)
{
return age;
}
马克:0出1
评论:
* Test 1 (0.0 out of 1)
Person.java:15: getAge(int) in Person cannot be applied to()
String s = (p.getAge() == 16 ? "getAge() Correct" : "getAge() not Correct");
^
1 error
The output should have been:
getAge() Correct
This is what was actually produced:
Exception in thread "main" java.lang.NoClassDefFoundError: Person
而不是(int年龄)它是否要我用一个Strin替换它G?
只是删除了参数,并挑选'this.age'。 – Davio 2015-02-01 13:05:42