{
int useless=0;
void wish()
{
System.out.print("努力学习各种知识!");
}
void speed()
{
System.out.print("我现在唯一的心愿是:");
wish();
}
}
class GraduateStudent extends Student
{
void wish()
{
System.out.print("好好学习,报效祖国!");
}
}
class UndergraduateStuadent extends Stuadent
{
void wish()
{
System.out.print("好好学习,天天向上!");
}
}
class Wishs
{
Student[]person=new Student[4];
void initialize()
{
person[0]=new GraduateStudent();
person[1]=new GraduateStudent();
person[2]=new GraduateStudent();
person[3]=new GraduateStudent();
}
void printWishes()
{
for(int i=0;i
}
}
class student
{
public void main(String[]args)
{
Wishes youWant=new Wishes();
youWant.initialize();
youWant.printWishes();
}
}
feida007 于 2011-07-14 16:55:31发表:
括号太多了,删掉几个就可以了
feida007 于 2011-07-14 16:54:35发表:
的
lgcHR 于 2011-07-13 18:47:53发表:
这个程序写的太烂了!类之间的依赖就是包含完全在恶搞。