单选题1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()A Just after line 5B Just after line 6C Just after line 7 (that is, as the method returns)D Never in this method.

单选题
1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()
A

 Just after line 5

B

 Just after line 6

C

 Just after line 7 (that is, as the method returns)

D

 Never in this method.


参考解析

解析: 暂无解析

相关考题:

1.public class GC{2.private Objec to;3.private void doSomethingElse(Object obj){o=obj;}4.public void doSomething(){5.Object o=new Object();6.doSomethingElse(o);7.o=new Object();8.doSomethingElse(null);9.o=null;10.}11.}When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()A.Line5B.Line6C.Line7D.Line8E.Line9F.Line10

publicclassX{2.publicobjectm(){3.objecto=newfloat(3.14F);4.object[]oa=newobject[1];5.oa[0]=o;6.o=null;7.oa[0]=null;10.returno;9.}10.}Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection?() A.Justafterline5.B.Justafterline6.C.Justafterline7.D.Justafterline8(thatis,asthemethodreturns).

publicclassX(2.publicobjectm(){3.objecto=newfloat(3.14F);4.object[]oa=newobject[1];5.oa[0]=o;6.o=null;7.returnoa[0];8.}9.}Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection?() A.Justafterline5B.Justafterline6C.Justafterline7(thatis,asthemethodreturns)D.Neverinthismethod.

public class X {  public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   return oa[0];   }   }   When is the float object created in line 3, eligible for garbage collection?()A、 Just after line 5B、 Just after line 6C、 Just after line 7 (that is, as the method returns)D、 Never in this method.

1. class TestA {  2. TestB b;  3. TestA() {  4. b = new TestB(this);  5. }  6. }  7. class TestB {  8. TestA a;  9. TestB(TestA a) {  10. this.a = a;  11. }  12. }  13. class TestAll {  14. public static void main (String args[]) {  15. new TestAll().makeThings(); 16. // ...code continues on  17. }  18. void makeThings() {  19. TestA test = new TestA(); 20. }  21. }  Which two statements are true after line 15, before main completes?()A、 Line 15 causes a stack overflow.B、 An exception is thrown at runtime.C、 The object referenced by a is eligible for garbage collection.D、 The object referenced by b is eligible for garbage collection.E、 The object referenced by a is not eligible for garbage collection.F、 The object referenced by b is not eligible for garbage collection.

1. class Test {  2. private Demo d;  3. void start() {  4. d = new Demo();  5. this.takeDemo(d); 6. }  7.   8. void takeDemo(Demo demo) {  9. demo = null;  10. demo = new Demo(); 11. }  12. }  When is the Demo object, created on line 3, eligible for garbage collection?()  A、 After line 5.B、 After line 9.C、 After the start() method completes.D、 When the takeDemo() method completes.E、 When the instance running this code is made eligible for garbage collection.

10. public Object m() { 11. Object o = new Float(3.14F); 12. Object [] oa = new Object[1]; 13. oa[0] = o; 14. o = null; 15. return oa[0]; 16. } When is the Float object, created in line 11, eligible for garbage collection?()  A、 Just after line 13.B、 Just after line 14.C、 Never in this method.D、 Just after line 15 (that is, as the method returns).

1. public class GC {  2. private Object o;  3. private void doSomethingElse(Object obj) { o = obj; }  4. public void doSomething() {  5. Object o = new Object();  6. doSomethingElse(o);  7. o = new Object();  8. doSomethingElse(null);  9.o=null;  10. }  11. }  When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?() A、 Line 5B、 Line 6C、 Line 7D、 Line 8E、 Line 9F、 Line 10

1. import java.util.*;  2. class ForInTest {  3. static List list = new ArrayList();  4.  5. static List getList() { return list; }  6.  7. public static void main(String [] args) {  8. list.add("a"); list.add("b"); list.add("c");  9. // insert code here  10. System.out.print(o);  11. }  12. } 第 9 行插入哪一项将输出 abc?() A、for(char o: list)B、for(Object o: getList())C、for(Object o: getList();)D、for(Object o: o.getList())

1.public class GC{ 2.private Objec to; 3.private void doSomethingElse(Object obj){o=obj;} 4.public void doSomething(){ 5.Object o=new Object(); 6.doSomethingElse(o); 7.o=new Object(); 8.doSomethingElse(null); 9.o=null; 10.} 11.} When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()A、Line5B、Line6C、Line7D、Line8E、Line9F、Line10

1. public class Test {  2. public  T findLarger(T x, T y) {  3. if(x.compareTo(y)  0) {  4. return x;  5. } else {  6. return y;  7. }  8. }  9. }  and:  22. Test t = new Test();  23. // insert code here  Which two will compile without errors when inserted at line 23?() A、 Object x = t.findLarger(123, “456”);B、 int x = t.findLarger(123, new Double(456));C、 int x = t.findLarger(123, new Integer(456));D、 int x = (int) t.findLarger(new Double(123), new Double(456));

现有:  1.  import java.util.*;      2. class ForInTest  {  3.static List list - new ArrayList():      4.  5.static List getList()    {  return list;    }      6.  7.public static void main (Strincj[]  args)    {      8.list.add("a");  list.add("b");  list.add("c");      9.    //insert code here      10.    System.out.print (o);      11.    }      12.  }  第9行插入哪一项将输出abc?()     A、 for(char o: list)B、 for (Object o:  o.getList())C、 for(Object o: getList();)D、 for(Object o: getList())E、 for(Object o: o.getList();)

1. public class X (  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1];  5. oa[0]= o;  6. o = null;  7. return oa[0];  8. }  9. }   When is the float object created in line 3, eligible for garbage collection?()  A、 Just after line 5B、 Just after line 6C、 Just after line 7 (that is, as the method returns)D、 Never in this method.

1. public class X {  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1]; 5. oa[0]= o;  6. o = null;  7. oa[0] = null;  10. return o;  9. }  10. }  When is the float object created in line 3, eligible for garbage collection?()  A、 Just after line 5.B、 Just after line 6.C、 Just after line 7.D、 Just after line 8(that is, as the method returns).

public class X {   public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   oa[0] = null;   return o;   }   }   When is the float object created in line 3, eligible for garbage collection?()  A、 Just after line 5.B、 Just after line 6.C、 Just after line 7.D、 Just after line 8(that is, as the method returns).

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.

单选题10. public Object m() { 11. Object o = new Float(3.14F); 12. Object [] oa = new Object[1]; 13. oa[0] = o; 14. o = null; 15. return oa[0]; 16. } When is the Float object, created in line 11, eligible for garbage collection?()A Just after line 13.B Just after line 14.C Never in this method.D Just after line 15 (that is, as the method returns).

单选题现有:  1.  import java.util.*;      2. class ForInTest  {  3.static List list - new ArrayList():      4.  5.static List getList()    {  return list;    }      6.  7.public static void main (Strincj[]  args)    {      8.list.add("a");  list.add("b");  list.add("c");      9.    //insert code here      10.    System.out.print (o);      11.    }      12.  }  第9行插入哪一项将输出abc?()A for(char o: list)B for (Object o:  o.getList())C for(Object o: getList();)D for(Object o: getList())E for(Object o: o.getList();)

单选题1.public class GC{ 2.private Objec to; 3.private void doSomethingElse(Object obj){o=obj;} 4.public void doSomething(){ 5.Object o=new Object(); 6.doSomethingElse(o); 7.o=new Object(); 8.doSomethingElse(null); 9.o=null; 10.} 11.} When the doSomething method is called,after which line does the Object created in line 5 become available for garbage collection?()ALine5BLine6CLine7DLine8ELine9FLine10

单选题1. public class GC {  2. private Object o;  3. private void doSomethingElse(Object obj) { o = obj; }  4. public void doSomething() {  5. Object o = new Object();  6. doSomethingElse(o);  7. o = new Object();  8. doSomethingElse(null);  9.o=null;  10. }  11. }  When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?()A Line 5B Line 6C Line 7D Line 8E Line 9F Line 10

单选题1. class Test {  2. private Demo d;  3. void start() {  4. d = new Demo();  5. this.takeDemo(d); 6. }  7.   8. void takeDemo(Demo demo) {  9. demo = null;  10. demo = new Demo(); 11. }  12. }  When is the Demo object, created on line 3, eligible for garbage collection?()A After line 5.B After line 9.C After the start() method completes.D When the takeDemo() method completes.E When the instance running this code is made eligible for garbage collection.

单选题1. import java.util.*;  2. class ForInTest {  3. static List list = new ArrayList();  4.  5. static List getList() { return list; }  6.  7. public static void main(String [] args) {  8. list.add("a"); list.add("b"); list.add("c");  9. // insert code here  10. System.out.print(o);  11. }  12. } 第 9 行插入哪一项将输出 abc?()Afor(char o: list)Bfor(Object o: getList())Cfor(Object o: getList();)Dfor(Object o: o.getList())

多选题1. class TestA {  2. TestB b;  3. TestA() {  4. b = new TestB(this);  5. }  6. }  7. class TestB {  8. TestA a;  9. TestB(TestA a) {  10. this.a = a;  11. }  12. }  13. class TestAll {  14. public static void main (String args[]) {  15. new TestAll().makeThings(); 16. // ...code continues on  17. }  18. void makeThings() {  19. TestA test = new TestA(); 20. }  21. }  Which two statements are true after line 15, before main completes?()ALine 15 causes a stack overflow.BAn exception is thrown at runtime.CThe object referenced by a is eligible for garbage collection.DThe object referenced by b is eligible for garbage collection.EThe object referenced by a is not eligible for garbage collection.FThe object referenced by b is not eligible for garbage collection.

单选题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.

单选题public class X {   public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   oa[0] = null;   return o;   }   }   When is the float object created in line 3, eligible for garbage collection?()A Just after line 5.B Just after line 6.C Just after line 7.D Just after line 8(that is, as the method returns).

单选题1. public class X {  2. public object m ()  {  3. object o = new float (3.14F);  4. object [] oa = new object [1]; 5. oa[0]= o;  6. o = null;  7. oa[0] = null;  10. return o;  9. }  10. }  When is the float object created in line 3, eligible for garbage collection?()A Just after line 5.B Just after line 6.C Just after line 7.D Just after line 8(that is, as the method returns).

单选题public class X {  public object m () {   object o = new float (3.14F);   object oa = new object [1];   oa[0]= o;   o = null;   return oa[0];   }   }   When is the float object created in line 3, eligible for garbage collection?()A Just after line 5B Just after line 6C Just after line 7 (that is, as the method returns)D Never in this method.