标题:程序错误:The type Person is already defined
只看楼主
tuesday2
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-4-29
 问题点数:0 回复次数:0 
程序错误:The type Person is already defined
程序清单:Student1.java

class Person
{
public String name;
public int age;
public Person(String name,int age)
{
this.name=name;
this.age=age;
}
public Person() //如果不写这个构造函数,看看对类Student1有什么影响
{
}
public void getInfo()
{
System.out.println(name);
System.out.println(age);
}
}
class Student1 extends Person
{
public void study()
{
System.out.println("Studding");
}
public static void main(String[] args)
{
Person p=new Person();
p.name="person";
p.age=30;
p.getInfo();

Student1 s=new Student1();
s.name="student1";
s.age=16;
s.getInfo();
s.study();
}
}

程序错误: The type Person is already defined.
麻烦大家解释、修改一下。


搜索更多相关主题的帖子: already The Person defined 程序错误 
2007-10-06 11:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-175391-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.176681 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved