Tuesday, 2 April 2013

Array - 9

There are a number of labels in the source code below. These are 




package net.dharmaraj;

class Riddle {
public static void main(String[] args) 

String first,second; 
String riddle; 
if (args.length < 2) 
return; a: first = new String(args[0]); 
b: second = new String(args[1]); 
c: riddle = "When is a " + first; 
d: first = null; 
e: riddle += " like a " + second + "?"; 
f: second = null; 
g: System.out.println(riddle); 
h: args[0] = null; 
i: args[1] = null; 
j: 
}
}



labeled a through j. Which label identifies the earliest point where, 
after that line has executed, the object referred to by the variable 
first may be garbage collected? 
Select the one right answer. 
a) d: 
b) e: 
c) h: 
d) i: 
e) j: 

Ans :-

Output:-

Error: Could not find or load main class net.dharmaraj.dev


No comments:

Post a Comment