black

Java认证考试综合练习

登录

单项选择题

现有: 
1. interface Animal { 
2. void eat(); 
3. } 
4. 
5. // insert code here 
6. 
7. public class HouseCat extends Feline { 
8. public void eat() { } 
9. }  
和五个声明: 
abstract class Feline implements Animal { } 
abstract class Feline implements Animal { void eat(); } 
abstract class Feline implements Animal { public void eat(); } 
abstract class Feline implements Animal { public void eat() { } } 
abstract class Feline implements Animal { abstract public void eat(); } 
分别插入到第5行,有几个可以通过编译?() 

A.0
B.1
C.2
D.3

相关考题

单项选择题 现有:  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();  }  } 结果为:()

单项选择题 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   哪一个是结果?()

All Rights Reserved 版权所有©求知题库网库(csqiuzhi.com)

备案号:湘ICP备14005140号-1

经营许可证号:湘B2-20140064