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