JAVA中,写的Person类的class Person这行提示了The type Person is already
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/06/05 16:30:02
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
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类,你在你工程里仔细找找.
JAVA中,写的Person类的class Person这行提示了The type Person is already
JAVA中出现Person b=new teacher()怎么理解(补充:teacher类继承了person类)
The person I like is in the classroom 这里的主语可不可以看成The person
在Java中,有两个类Student和Person.如果Student是Person的子类,则下列声明对象x的语句中错误
when is a person not a person 的意思
英语翻译还有A person is a person because of another person的中文翻译
average person与ordinary person的区别
person的复数是persons还是person
he siys Mary is most fridly person in the class哪里错了?
The person is like my teacher.的同义句
encouter the right person is luck的中文翻译
The writer is ( )French person