black

Java认证考试综合练习

登录

单项选择题

现有: 
class Cat { 
Cat(int c) { System.out.print("cat" + c + " "); } 
} 
class SubCat extends Cat { 
SubCat(int c) { super(5); System.out.print("cable "); } 
SubCat() { this(4); } 
public static void main(String [] args) { 
SubCat s = new SubCat(); 
} 
}
结果为:() 

A.cat5
B.cable
C.cable cat5
D.cat5 cable

相关考题

单项选择题 class Dog { }  class Harrier extends Dog { }  class DogTest {  public static void main(String [] args) {  Dog d1 = new Dog();  Harrier h1 = new Harrier();  Dog d2 = h1;  Harrier h2 = (Harrier) d2;  Harrier h3 = d2;  }  }  下面哪一项是正确的?()

单项选择题 现有:   class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }   public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");  } catch (Exception e) { }  }   }   和命令行:  java ThreadExcept 1000   哪一个是结果?()

单项选择题 程序员想要创建一个名为MyThread的类以便在main方法中用Thread实例化。对于下面三行:   MyThread必须继承Thread。   MyThread必须实现Thread。   MyThread必须覆盖public void run()。   有几行是正确的?()

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3