abstract class Show //抽象类
{
public void run(){ runcode();}
public abstract void runcode();
}
class Student extends Show //student继承Show,复写了父类的runcode,
{
public void runcode(){int x=1;System.out.pringt(x);}
}
class Temp
{
public static void main(String[] args) //new一个对象,调用run
{ Student s = new Student();
s.run();
} |