下列关于接口的说法中,错误的是?( )
A. 接口中定义的方法默认使用"public abstract"来修饰
B. 接口中的变量默认使用"public static final"来修饰
C. 接口中的方法有抽象方法、默认方法、静态方法
D. 接口中定义的变量可以被修改
下面程序运行的结果是( )class Demo{ public static void main(String[] args){try{ int x = div(1,2); }catch(Exception e){ System.out.println(e); }System.out.println(x) } public static int div(int a,int b){ return a / b ; }}A.B.C.D.
A. 输出1
B. 输出0
C. 输出0.5
D. 编译失败
下列程序运行结果是( )public class Demo { public static void main(String[] args) {Demo demo = new Demo();demo.show(new Car() {public void run() {System.out.println("demo run");}}); } public void show(Car c) {c.run(); }}abstract class Car {public void run() {System.out.println("car run..."); }}
A. car run
B. demo run
C. 无结果
D. 编译报错
阅读下列的程序public class Example { public static void main(String[] args) {new Father () {public void show() {System.out.println("helloworld");}}.show(); }}class Father { public void show() {System.out.println("hellofather"); }}A.B.C.D.
A. hellofather
B. helloworld
C. 编译报错
D. 编译通过,运行报错