abstract class Student
{
public abstract void study();
public void sleep()
{
System.out.println("躺着睡");
}
}
class BaseStudent extends Student
{
public void study()
{
System.out.println("base study");
}
public void sleep()
{
System.out.println("坐着睡");
}
}
class AdvStudent extends Student
{
public void study()
{
System.out.println("Adv study");
}
}
class DoStudent
{
public void doSome(Student stu);
{
stu.study(); //就是对这个地方不理解啊。
stu.sleep(); //我看毕老师的编译能通过,我编译就提示doSome缺少方法主体,或声明抽象。还有就是这个工具类我也不太懂他的意思!
}
}
class DuoTaiDemo3
{
public static void main(String[] args)
{
DoStudent ds=new DoStudent();
ds.doSome(new BaseStudent());
//BaseStudent bs=new BaseStudet();
//bs.study();
//bs.sleep();
//AdvStudent as=new AdvStudent();
//as.study();
//as.sleep();
}
}
|