作者: 许飞翔 时间: 2012-3-21 18:58
abstract class Person
{
public Person()
{
System.out.println("人");
this.empt();
}
public abstract void empt();
}
class Students extends Person
{
private int score = 20;
public Students(int score)
{
System.out.println(this.score);
this.score = score;
}
public void empt()
{
System.out.println(" score = "+ score);
}
}
class Demo
{
public static void main(String[] args)
{
Person per = new Students(6);
per.empt();
}
}
经过楼上几个回答,我对代码修改了一下,这就看得明白了,也知道是怎么一回事了。谢谢大家