niusouti.com

多选题Click the Exhibit button. Which three code fragments, added individually at line 29, produce the output 100?()An = 100;Bi.setX( 100 );Co.getY().setX( 100 );Di = new Inner(); i.setX( 100 );Eo.setY( i ); i = new Inner(); i.setX( 100 );Fi = new Inner(); i

题目
多选题
Click the Exhibit button. Which three code fragments, added individually at line 29, produce the output 100?()
A

n = 100;

B

i.setX( 100 );

C

o.getY().setX( 100 );

D

i = new Inner(); i.setX( 100 );

E

o.setY( i ); i = new Inner(); i.setX( 100 );

F

i = new Inner(); i.setX( 100 ); o.setY( i );


相似考题
更多“多选题Click the Exhibit button. Which three code fragments, added individually at line 29, produce the output 100?()An = 100;Bi.setX( 100 );Co.getY().setX( 100 );Di = new Inner(); i.setX( 100 );Eo.setY( i ); i = new Inner(); i.setX( 100 );Fi = new Inner(); i”相关问题
  • 第1题:

    当你编译运行下列程序代码,会得到什么结果?

    private class Base{ Base(){ int i = 100; System.out.println(i); } }

    public class Pri extends Base{ staticint i = 200;

    public static void main(String argv[]){ Pri p = new Pri(); System.out.println(i); } }

    A.这段代码不能通过编译

    B.输出200

    C.输出100和200

    D.输出100


    正确答案:A

  • 第2题:

    以下程序调试结果为:class Base{Base(){int i = 100;System.out.print (i);}}public class Pri extends Base{static int i = 200;public static void main(String argv[]){Pri p = new Pri();System.out.print(i);}}

    A.编译错误

    B.200

    C.100200

    D.100


    正确答案:C

  • 第3题:

    package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?() 

    • A、 Compilation fails.
    • B、 An instance of the Inner class can be constructed with “new Outer.Inner()”.
    • C、 An instance of the Inner class cannot be constructed outside of package foo.
    • D、 An instance of the Inner class can be constructed only from within the Outer class.
    • E、 From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.

    正确答案:B

  • 第4题:

    下面哪一个是合法的数组声明和构造语句()

    • A、 int[] ages = [100];
    • B、 int ages = new int[100];
    • C、 int[] ages = new int[100];
    • D、 int() ages = new int(100);

    正确答案:C

  • 第5题:

    class Foo {  private int x;  publicFoo(intx) {this.x=x; }  public void setX( int x) { this.x = x; }  public int getX() { return x; }  }   public class Gamma {  static Foo fooBar( Foo foo) {  foo = new Foo( 100);  return foo;  }  public static void main( String[] args) {  Foo foo = new Foo( 300);  System.out.print( foo.getX() + “-“);  Foo fooFoo = fooBar( foo);  System.out.print( foo.getX() + “-“);  System.out.print( fooFoo.getX() + “-“);  foo = fooBar( fooFoo);  System.out.print( foo.getX() + “-“);  System.out.prmt( fooFoo.getX());  }  }  What is the output of this program?()

    • A、 300-100-100-100-100
    • B、 300-300-100-100-100
    • C、 300-300-300-100-100
    • D、 300-300-300-300-100

    正确答案:B

  • 第6题:

    10. class Inner {  11. private int x;  12. public void setX( int x) { this.x = x; }  13. public int getX() { return x; }  14. }  15.  16. class Outer {  17. private Inner y;  18. public void setY( Inner y) { this.y = y; }  19. public Inner getY() { return y; }  20. }  21.  22. public class Gamma {  23. public static void main( String[] args) { 24. Outer o = new Outer(); 25. Inner i = new Inner();  26.int n=10;  27. i.setX(n);  28. o.setY(i);  29. // insert code here  30. System.out.println( o.getY().getX());  31. }  32. }  Which three code fragments, added individually at line 29, produce the output 100?()

    • A、 n = 100;
    • B、 i.setX( 100);
    • C、 o.getY().setX( 100);
    • D、 i = new Inner(); i.setX( 100);
    • E、 o.setY( i); i = new Inner(); i.setX( 100);
    • F、 i = new Inner(); i.setX( 100); o.setY( i);

    正确答案:B,C,F

  • 第7题:

    class Birds {  public static void main(String [] args) {  try {  throw new Exception();  } catch (Exception e) { try {  throw new Exception();  } catch (Exception e2) { System.out.print("inner "); }  System.out.print("middle "); }  System.out.print("outer ");  }  }  结果为:()  

    • A、inner
    • B、inner outer
    • C、middle outer
    • D、inner middle outer

    正确答案:D

  • 第8题:

    单选题
    1. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()
    A

     new Inner(); // At line 3

    B

     new Inner(); // At line 8

    C

     new o.Inner(); // At line 8

    D

     new Outer.Inner(); // At line 8


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

  • 第9题:

    多选题
    10. class Inner {  11. private int x;  12. public void setX( int x) { this.x = x; }  13. public int getX() { return x; }  14. }  15.  16. class Outer {  17. private Inner y;  18. public void setY( Inner y) { this.y = y; }  19. public Inner getY() { return y; }  20. }  21.  22. public class Gamma {  23. public static void main( String[] args) { 24. Outer o = new Outer(); 25. Inner i = new Inner();  26.int n=10;  27. i.setX(n);  28. o.setY(i);  29. // insert code here  30. System.out.println( o.getY().getX());  31. }  32. }  Which three code fragments, added individually at line 29, produce the output 100?()
    A

    n = 100;

    B

    i.setX( 100);

    C

    o.getY().setX( 100);

    D

    i = new Inner(); i.setX( 100);

    E

    o.setY( i); i = new Inner(); i.setX( 100);

    F

    i = new Inner(); i.setX( 100); o.setY( i);


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

  • 第10题:

    单选题
    Click the Exhibit button.   What is the output of the program shown in the exhibit? ()
    A

     300-300-100-100-100

    B

     300-300-300-100-100

    C

     300-300-300-300-100

    D

     300-100-100-100-100


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

  • 第11题:

    多选题
    Which two code fragments correctly create and initialize a static array of int elements()
    A

    static final int[]a={100,200};

    B

    static final int[]a;static{a=new int[2];a[0]=100;a[1]=200;}

    C

    static final int[]a=new int[2]{100,200};

    D

    static final int[]a;static void int(){a=new int[3];a[0]=100;a[1]=200;}


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

  • 第12题:

    单选题
    下面哪一个是合法的数组声明和构造语句()
    A

    int[]ages=[100];

    B

    int ages=new int[100];

    C

    int[]ages=new int[100];

    D

    int()ages=new int(100);


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

  • 第13题:

    以下程序的调试结果为?

    public class Outer{

    public String name = "Outer";

    public static void main(String argv[]){

    Inner i = new Inner();

    i.showName();

    }

    private class Inner{

    String name =new String("Inner");

    void showName(){

    System.out.println(name);

    }

    }

    }

    A.输出结果 Outer

    B.输出结果 Inner

    C.编译错误,因Inner类定义为私有访问

    D.在创建Inner类实例的行出现编译错误


    正确答案:D

  • 第14题:

    1. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()  

    • A、 new Inner(); // At line 3
    • B、 new Inner(); // At line 8
    • C、 new o.Inner(); // At line 8
    • D、 new Outer.Inner(); // At line 8

    正确答案:A

  • 第15题:

    Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }  

    • A、c = b;
    • B、c = this.a;
    • C、c = this.b;
    • D、c = Q4a39.this.a;
    • E、c = c;

    正确答案:A,D

  • 第16题:

    package foo; public class Outer (  public static class Inner (  )  )   Which statement is true? () 

    • A、 An instance of the Inner class can be constructed with “new Outer.Inner ()”
    • B、 An instance of the inner class cannot be constructed outside of package foo.
    • C、 An instance of the inner class can only be constructed from within the outer class.
    • D、 From within the package bar, an instance of the inner class can be constructed with “new inner()”

    正确答案:A

  • 第17题:

    public class enclosingone (    public class insideone{}   )   public class inertest(   public static void main (stringargs)(   enclosingone eo= new enclosingone ();    //insert code here  )  )   Which statement at line 7 constructs an instance of the inner class?()

    • A、 InsideOnew ei= eo.new InsideOn();
    • B、 Eo.InsideOne ei = eo.new InsideOne();
    • C、 InsideOne ei = EnclosingOne.new InsideOne();
    • D、 EnclosingOne.InsideOne ei = eo.new InsideOne();

    正确答案:D

  • 第18题:

    Consider the following class:     class Test(int i) {     void test(int i) {  System.out.println(“I am an int.”); }    void test(String s) {   System.out.println(“I am a string.”);     }          public static void main(String args) {    Test t=new Test();     char ch=“y”;    t.test(ch);     }      }     Which of the statements below is true?()

    • A、 Line 5 will not compile, because void methods cannot be overridden.
    • B、 Line 12 will not compile, because there is no version of test() that rakes a charargument.
    • C、 The code will compile but will throw an exception at line 12.
    • D、 The code will compile and produce the following output: I am an int.
    • E、 The code will compile and produce the following output: I am a String.

    正确答案:D

  • 第19题:

    Which two code fragments correctly create and initialize a static array of int elements?()

    • A、static final int[] a = { 100,200 };
    • B、static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
    • C、static final int[] a = new int[2]{ 100,200 };
    • D、static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }

    正确答案:A,B

  • 第20题:

    单选题
    package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?()
    A

     Compilation fails.

    B

     An instance of the Inner class can be constructed with “new Outer.Inner()”.

    C

     An instance of the Inner class cannot be constructed outside of package foo.

    D

     An instance of the Inner class can be constructed only from within the Outer class.

    E

     From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.


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

  • 第21题:

    多选题
    Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }
    A

    c = b;

    B

    c = this.a;

    C

    c = this.b;

    D

    c = Q4a39.this.a;

    E

    c = c;


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

  • 第22题:

    单选题
    Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()
    A

     The code runs with no output.

    B

     Compilation fails.

    C

     An exception is thrown at runtime.

    D

     ClassC is displayed.


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

  • 第23题:

    单选题
    Click the Exhibit button. In the exhibit, what is the priority for Router B in VRRP group 100?()
    A

    1

    B

    100

    C

    110

    D

    255


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