1. class Bar {&e

题目

1. class Bar { }  1. class Test {  2. Bar doBar() {  3. Bar b = new Bar();  4. return b;  5. }  6. public static void main (String args[]) {  7. Test t = new Test();  8. Bar newBar = t.doBar();  9. System.out.println(“newBar”);  10. newBar = new Bar();  11. System.out.println(“finishing”);  12. }  13. } At what point is the Bar object, created on line 3, eligible for garbage collection?()  

  • A、 After line 8.
  • B、 After line 10.
  • C、 After line 4, when doBar() completes.
  • D、 After line 11, when main() completes.
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Given:Which code, inserted at line 15, allows the class Sprite to compile?()

A.Foo { public int bar() { return 1; }

B.new Foo { public int bar() { return 1; }

C.new Foo() { public int bar() { return 1; }

D.new class Foo { public int bar() { return 1; }


参考答案:C

第2题:

摩托罗拉General参数中,“cell_bar_access_class”的参数取值范围:0-65553

A.错误

B.正确


参考答案:A

第3题:

C2参数不包括()。

A.cell_bar_qualify

B.temporary_offset

C.penalty_time

D.cell_bar_access_class


正确答案:B

第4题:

1. public interface A {  2. public void doSomething(String thing);  3. }  1. public class AImpl implements A {  2. public void doSomething(String msg) { }  3. }  1. public class B {  2. public A doit() {  3. // more code here  4. }  5.  6. public String execute() { 7. // more code here  8. }  9. }  1. public class C extends B {  2. public AImpl doit() {  3. // more code here  4. }  5.  6. public Object execute() {  7. // more code here  8. }  9. }  Which statement is true about the classes and interfaces in the exhibit?() 

  • A、 Compilation will succeed for all classes and interfaces.
  • B、 Compilation of class C will fail because of an error in line 2.
  • C、 Compilation of class C will fail because of an error in line 6.
  • D、 Compilation of class AImpl will fail because of an error in line 2.

正确答案:C

第5题:

public class Threads5 {  public static void main (String[] args) {  new Thread(new Runnable() {  public void run() {  System.out.print(”bar”);  } }).start();  }  }  What is the result?() 

  • A、 Compilation fails.
  • B、 An exception is thrown at runtime.
  • C、 The code executes normally and prints “bar”.
  • D、 The code executes normally, but nothing prints.

正确答案:C

第6题:

有如下类声明: class Foo{ int bar; }; 则Foo类的成员bar是

A.公有数据成员

B.公有成员函数

C.私有数据成员

D.私有成员函数


正确答案:C
解析:默认属性为private。

第7题:

C2参数不包括:()

  • A、cell_bar_qualify
  • B、temporary_offset
  • C、penalty_time
  • D、cell_bar_access_class

正确答案:A,D

第8题:

Click the Exhibit button. Given the fully-qualified class names: com.foo.bar.Dog com.foo.bar.blatz.Book com.bar.Car com.bar.blatz.Sun Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM? ()

A.Jar A

B.Jar B

C.Jar C

D.Jar D

E.Jar E


参考答案:A

第9题:

public class Test {   public static void main (String args) {  string foo = “blue”;  string bar = foo;   foo = “green”;   System.out.printIn(bar);   }   }   What is the result?()  

  • A、 An exception is thrown.
  • B、 The code will not compile.
  • C、 The program prints “null”
  • D、 The program prints “blue”
  • E、 The program prints “green”

正确答案:D

第10题:

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

更多相关问题