interface interdemo //定义了个接口
{
public static final int a = 40;
public abstract void show();
}
abstract class absdemo //定义了个抽象类
{
public static final int a = 40;
public abstract void show();
}
class testin implements interdemo
{
public void show()
{
System.out.println(a);
}
}
class testin2 extends absdemo
{
public void show()
{
System.out.println(a);
}
}
这两个使用起来好像没什么区别,然后抽象类和接口的具体区别在哪?
|
|