验证可以存在 (但是没有意义
)abstract class clsTest{
public static int GetInt()
{ return 1; }
//public abstract void eat();
}
class clsTest2 extends clsTest{
public void sleep(){
System.out.println("Dog sleep.");
}
public void eat(){
System.out.println("Dog eat.");
}
}
int i ;
clsTest k=null;
k=new clsTest2();
k.GetInt();
k.sleep();------错误Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method sleep() is undefined for the type clsTest