多选题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 );

参考答案和解析
正确答案: E,A
解析: 暂无解析
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

A.Compilation fails.

B.ClassC is displayed.

C.The code runs with no output.

D.An exception is thrown at runtime.


参考答案:D

第2题:

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

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

第3题:

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;}


参考答案:A, B

第4题:

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

第5题:

以下程序调试结果为: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

第6题:

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

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

第7题:

以下程序的调试结果为?

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

第8题:

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 );


参考答案:B, C, F

第9题:

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

第10题:

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

更多相关问题