题目内容

下面程序运行的结果是( )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. 编译通过,运行报错

下列关于匿名内部类的描述,错误的是( )

A. 匿名内部类是内部类的简化形式
B. 匿名内部类的前提是必须要继承父类或实现接口
C. 匿名内部类的格式是"new 父类(参数列表) 或 父接口(){}"
D. 匿名内部类可以有构造方法

以下关于super关键字的说法中,正确的是( )

A. super()与this()关键字可以同时存在于同一个构造方法中
B. super()与this()关键字不能同时存在于同一个构造方法中
C. super关键字可以调用父类的成员方法
D. super关键字可以调用父类的构造方法

答案查题题库