易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

1.class TestSuper { 22.TestSuper(int i) { } 3. } 4.class TestSub extends TestSuper{ } 5.class TestAll { 6.public static void main (String [] args) { 7.new TestSub(); 8.} 9.} Which is true?()  

A、 Compilation fails.

B、 The code runs without exception.

C、 An exception is thrown at line 7.

D、 An exception is thrown at line 2.

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • 1. import java.util.*;  2. public class Test {  3. public static void main(String[] args) {  4. List strings = new ArrayList();  5. // insert code here  6. }  7. }  Which four, inserted at line 5, will allow compilation to succeed?()

    A

     String s = strings.get(0);

    B

     Iterator i1 = strings.iterator();

    C

     String[] array1 = strings.toArray();

    D

     Iterator i2 = strings.iterator();

    E

     String[] array2 = strings.toArray(new String[1]);

    F

     Iterator i3 = strings.iterator();

  • package geometry;  public class Hypotenuse {  public InnerTriangle it = new InnerTriangle();  class InnerTriangle {  public int base;  public int height;  }  }  Which is true about the class of an object that can reference the variable base? ()

    A、 It can be any class.

    B、 No class has access to base.

    C、 The class must belong to the geometry package.

    D、 The class must be a subclass of the class Hypotenuse.

  • public class Foo implements Runnable (  public void run (Thread t) {  system.out.printIn(“Running.”);  }  public static void main (String[] args)  {  new thread (new Foo()).start();  } )   What is the result?()      

    A、 An exception is thrown.

    B、 The program exists without printing anything.

    C、 An error at line 1 causes compilation to fail.

    D、 An error at line 2 causes the compilation to fail.

    E、 “Running” is printed and the program exits.

  • Which two are true about has-a and is-a relationships?()

    A

     Inheritance represents an is-a relationship.

    B

     Inheritance represents a has-a relationship.

    C

     Interfaces must be used when creating a has-a relationship.

    D

     Instance variables can be used when creating a has-a relationship.

  • Which capability exists only in java.io.BufferedWriter?()

    A、Closing an open stream.

    B、Flushing an open stream.

    C、Writing to an open stream.

    D、Writing a line separator to an open stream.

联系客服 会员中心
TOP