- 博客(0)
- 资源 (1)
空空如也
java 抽象类练习题
java 抽象类 接口 异常 练习题
1.在使用interface声明一个接口时,只可以使用哪个修饰符修饰该接口(D)。
A.private B.protected
C.private protected D.public
2.下列程序运行的结果是(B)。
interface InterfaceA{
int max=100;
void f();
}
class ClassA implements InterfaceA{
public void f(){System.out.print(max);}
}
class ClassB{
void g(InterfaceA a){a.f();}
}
public class E {
public static void main(String[] args) {
ClassB b=new ClassB();
b.g(new ClassA());
}
}
2013-05-31
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人