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
满神洗发水 1年前 已收到1个回答 举报

寻常人家1 春芽

共回答了19个问题采纳率:84.2% 举报

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

1年前

10
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.017 s. - webmaster@yulucn.com