public class TestA{    public void methodA() throws IOException{        //……    } }  public class TestB extends TestA{    public void methodA() throws EOFException{        //……   } }  public class TestC extends TestA{    public void methodA() throws Exce

题目

public class TestA{    public void methodA() throws IOException{        //……    } }  public class TestB extends TestA{    public void methodA() throws EOFException{        //……   } }  public class TestC extends TestA{    public void methodA() throws Exception{        //……   } }  当编译类TestC的时候,结果是哪项?() 

  • A、 正常
  • B、 编译错误
  • C、 运行错误
  • D、 以上都不对

相似考题
更多“public class TestA{    public void methodA() throws IOException{        //……    } }  public class TestB extends TestA{    public void methodA() throws EOFException{        //……   } }  public class TestC extends TestA{    public void methodA() throws Excep”相关问题
  • 第1题:

    Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()

    • A、 abstract public void methoda ();
    • B、 public abstract double inethoda ();
    • C、 static void methoda (double dl) {}
    • D、 public native double methoda () {}
    • E、 protected void methoda (double dl) {}

    正确答案:C

  • 第2题:

    class TestA {  public void start() { System.out.println(”TestA”); }  }  public class TestB extends TestA {  public void start() { System.out.println(”TestB”); } public static void main(String[] args) {  ((TestA)new TestB()).start();  }  }  What is the result?() 

    • A、 TestA
    • B、 TestB
    • C、 Compilation fails.
    • D、 An exception is thrown at runtime.

    正确答案:B

  • 第3题:

    public class ExceptionTest {   class TestException extends Exception {}   public void runTest () throws TestException {}   public void test () /* Point X*/ {   runTest ();   }   }   At point X on line 4, which code can be added to make the code compile?()  

    • A、 Throws Exception.
    • B、 Catch (Exception e).
    • C、 Throws RuntimeException.
    • D、 Catch (TestException e).
    • E、 No code is necessary.

    正确答案:B

  • 第4题:

    import java.io.IOException;   public class ExceptionTest(   public static void main (Stringargs)  try (   methodA();   ) catch (IOException e) (   system.out.printIn(“Caught IOException”);  ) catch (Exception e) (   system.out.printIn(“Caught Exception”);   )   )   public void methodA () {   throw new IOException ();  }     What is the result?()  

    • A、 The code will not compile.
    • B、 The output is caught exception.
    • C、 The output is caught IOException.
    • D、 The program executes normally without printing a message.

    正确答案:A

  • 第5题:

    Which will declare a method that is available to all members of the same package and can be referenced without an instance of the class?()  

    • A、 Abstract public void methoda();
    • B、 Public abstract double methoda();
    • C、 Static void methoda(double d1){}
    • D、 Public native double methoda()  {}
    • E、 Protected void methoda(double d1)  {}

    正确答案:C

  • 第6题:

    public class Starter extends Thread {  private int x= 2;  public static void main(String[] args) throws Exception {  new Starter().makeItSo();  }  public Starter() {  x=5;  start();  }  public void makeItSo() throws Exception {  join();  x=x- 1;  System.out.println(x);  }  public void run() { x *= 2; }  }  What is the output if the main() method is rum?() 

    • A、 4
    • B、 5
    • C、 8
    • D、 9
    • E、 Compilation fails.
    • F、 An exception is thrown at runtime.
    • G、 It is impossible to determine for certain.

    正确答案:D

  • 第7题:

    public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()

    • A、 public class Circle implements Shape { private int radius; }
    • B、 public abstract class Circle extends Shape { private int radius; }
    • C、 public class Circle extends Shape { private int radius; public void draw(); }
    • D、 public abstract class Circle implements Shape { private int radius; public void draw(); }
    • E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }
    • F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

    正确答案:B,E

  • 第8题:

    单选题
    import java.io.IOException;  public class ExceptionTest(  public static void main (String[]args)  try (  methodA();  ) catch (IOException e)  (  system.out.printIn(“Caught IOException”);  ) catch (Exception e)   (  system.out.printIn(“Caught Exception”);  )  )  public void methodA ()   {  throw new IOException ();  }   What is the result?()
    A

     The code will not compile.

    B

     The output is caught exception.

    C

     The output is caught IOException.

    D

     The program executes normally without printing a message.


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    public class TestA{   public void methodA()  throws IOException{   //……   }   }   public class TestB extends TestA{   public void methodA()  throws EOFException{   //……   }   }   public class TestC extends TestA{   public void methodA()  throws Exception{   //……   }   }   当编译类TestC的时候,结果是哪项?()
    A

     正常

    B

     编译错误

    C

     运行错误

    D

     以上都不对


    正确答案: B
    解析: 暂无解析

  • 第10题:

    单选题
    public class SomeException {  } Class a:  public class a {  public void doSomething() { }  } Class b:  public class b extends a {  public void doSomething() throws SomeException { }  }  Which is true about the two classes?()
    A

     Compilation of both classes will fail.

    B

     Compilation of both classes will succeed.

    C

     Compilation of class a will fail. Compilation of class b will succeed.

    D

     Compilation of class a will fail. Compilation of class a will succeed.


    正确答案: A
    解析: 暂无解析

  • 第11题:

    单选题
    Which will declare a method that is available to all members of the same package and be referenced without an instance of the class?()
    A

     abstract public void methoda ();

    B

     public abstract double inethoda ();

    C

     static void methoda (double dl) {}

    D

     public native double methoda () {}

    E

     protected void methoda (double dl) {}


    正确答案: A
    解析: 暂无解析

  • 第12题:

    单选题
    现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?()
    A

     public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }

    B

    public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }

    C

    public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }

    D

    public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }


    正确答案: A
    解析: 暂无解析

  • 第13题:

    interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?() 

    • A、 public class Employee extends Info implements Data { public void load() { /*do something*/ } }
    • B、 public class Employee implements Info extends Data { public void load() { /*do something*/ } }
    • C、 public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
    • D、 public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
    • E、 public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
    • F、 public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }

    正确答案:A

  • 第14题:

    1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()  

    • A、 No code is necessary.
    • B、 throws Exception
    • C、 catch ( Exception e )
    • D、 throws RuntimeException
    • E、 catch ( TestException e)

    正确答案:B

  • 第15题:

    现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?() 

    • A、 public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }
    • B、public class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }
    • C、public class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }
    • D、public class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

    正确答案:B

  • 第16题:

    现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()     

    • A、  TeStA
    • B、  TeStB
    • C、编译失败
    • D、运行时抛出异常

    正确答案:B

  • 第17题:

    public class TestA{   public void methodA()  throws IOException{   //……   }   }   public class TestB extends TestA{   public void methodA()  throws EOFException{   //……   }   }   public class TestC extends TestA{   public void methodA()  throws Exception{   //……   }   }   当编译类TestC的时候,结果是哪项?() 

    • A、 正常
    • B、 编译错误
    • C、 运行错误
    • D、 以上都不对

    正确答案:B

  • 第18题:

    Which will declare a method that forces a subclass to implement it?() 

    • A、 Public double methoda();
    • B、 Static void methoda (double d1) {}
    • C、 Public native double methoda();
    • D、 Abstract public void methoda();
    • E、 Protected void methoda (double d1){}

    正确答案:D

  • 第19题:

    单选题
    1. public class Exception Test {  2. class TestException extends Exception {}  3. public void runTest() throws TestException {}  4. public void test() /* Point X */ {  5. runTest();  6. }  7. }  At Point X on line 4, which code is necessary to make the code compile?()
    A

     No code is necessary.

    B

     throws Exception

    C

     catch ( Exception e )

    D

     throws RuntimeException

    E

     catch ( TestException e)


    正确答案: E
    解析: 暂无解析

  • 第20题:

    单选题
    Which will declare a method that forces a subclass to implement it? ()
    A

     Public double methoda();

    B

     Static void methoda (double d1) {}

    C

     Public native double methoda();

    D

     Abstract public void methoda();

    E

     Protected void methoda (double d1){}


    正确答案: B
    解析: 暂无解析

  • 第21题:

    单选题
    现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()
    A

      TeStA

    B

      TeStB

    C

    编译失败

    D

    运行时抛出异常


    正确答案: C
    解析: 暂无解析

  • 第22题:

    单选题
    interface Data { public void load(); }  abstract class Info { public abstract void load(); }  Which class correctly uses the Data interface and Info class?()
    A

     public class Employee extends Info implements Data { public void load() { /*do something*/ } }

    B

     public class Employee implements Info extends Data { public void load() { /*do something*/ } }

    C

     public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }

    D

     public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }

    E

     public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }

    F

     public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    public class ExceptionTest {  class TestException extends Exception {}  public void runTest () throws TestException {}  public void test () /* Point X*/  {  runTest ();  }  }   At point X on line 4, which code can be added to make the code compile?()
    A

     Throws Exception.

    B

     Catch (Exception e).

    C

     Throws RuntimeException.

    D

     Catch (TestException e).

    E

     No code is necessary.


    正确答案: A
    解析: 暂无解析

  • 第24题:

    单选题
    Which will declare a method that is available to all members of the same package and can be referenced  without an instance of the class?()
    A

     Abstract public void methoda();

    B

     Public abstract double methoda();

    C

     Static void methoda(double d1){}

    D

     Public native double methoda(){}

    E

     Protected void methoda(double d1){}


    正确答案: C
    解析: 暂无解析