单项选择题
11.class Snoochy{
12.Boochybooch;
13.public Snoochy(){booch=newBoochy(this);}
14.}
15.
16.class Boochy{
17.Snoochy snooch;
18.public Boochy(Snoochys){snooch=s;}
19.}
And the statements:
21.public static void main(String[]args){
22.Snoochy snoog=new Snoochy();
23.snoog=null;
24.//more code here
25.}
Which statement is true about the objects referenced by snoog,snooch,and booch immediately after line 23 executes?()
A.None of these objects are eligible for garbage collection.
B.Only the object referenced by booch is eligible for garbage collection.
C.Only the object referenced by snoog is eligible for garbage collection.
D.Only the object referenced by snooch is eligible for garbage collection.
E.The objects referenced by snooch and booch are eligible for garbage collection.
相关考题
-
单项选择题
11.rbo = new ReallyBigObject(); 12.//more code here 13.rbo = null; 14./*insert code here*/ Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the objectrbo?()
A.System.gc();
B.Runtime.gc();
C.System.freeMemory();
D.Runtime.getRuntime().growHeap();
E.Runtime.getRuntime().freeMemory(); -
单项选择题
package test; class Target{ public String name="hello"; } What can directly access and change the value of the variable name?()
A.any class
B.only the Target class
C.any class in the test package
D.any class that extends Target -
单项选择题
Given a class Repetition: 1.package utils; 2. 3.public class Repetition{ 4.public static String twice(Strings){returns+s;} 5.} and given another class Demo: 1.//insert code here2. 3.public class Demo{ 4.public static void main(String[]args){ 5.System.out.println(twice("pizza")); 6.} 7.} Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()
A.import utils.*;
B.static import utils.*;
C.importutils.Repetition.*;
D.static importutils.Repetition.*;
E.import utils.Repetition.twice();
F.import static utils.Repetition.twice;
G.static import utils.Repetition.twice;
