JAVA中,写的Person类的class Person这行提示了The type Person is already defined.的错误,是什么情况?class Person {\x05private String name;\x05private int age;\x05public void setName(String n) {\x05\x05name = n;\x05}\x05public void setAge(int a) {\x05\x05age = a;\x05}\x05public String getName() {\x05\x05return name;\x05}\x05public int getAge() {\x05\x05return age;\x05}\x05public void tell() {\x05\x05System.out.println(getName());\x05}}public class Ccl {\x05public static voi

问题描述:

JAVA中,写的Person类的class Person这行提示了The type Person is already defined.的错误,是什么情况?
class Person {
\x05private String name;
\x05private int age;
\x05public void setName(String n) {
\x05\x05name = n;
\x05}
\x05public void setAge(int a) {
\x05\x05age = a;
\x05}
\x05public String getName() {
\x05\x05return name;
\x05}
\x05public int getAge() {
\x05\x05return age;
\x05}
\x05public void tell() {
\x05\x05System.out.println(getName());
\x05}
}
public class Ccl {
\x05public static void main(String[] args) {
\x05\x05Person per = new Person();
\x05\x05per.setName("Martin");
\x05\x05per.setAge(30);
\x05\x05per.tell();
\x05}
}
提示错误,可以运行,但是不管tell()里面的输出内容有几个,输出结果都是Name:MartinAge:30

别的地方定义了一个Person类,你在你工程里仔细找找.