java抽象类怎么实例化
抽象类不能实例化,必须有子类或者匿名子类,例子:
public abstract class p{
public void test();
}
public class pp extends p{
public void test(){
System.out.println('');
}
}
public static void main(String[] args){
p pobj = new pp();
p pobj2= nen p(){
public void test(){
Sytem.out.println('xxxx');
}
}
}
赞0
踩0