Hi, This questionis from Jxam mock exam. i think given answer is wrong. Consider the following piece of code and select the correct statements.
1. Object o = new String("abcd"); 2. String s = o; 3. System.out.println(s); 4. System.out.println(o); 1. The following is displayed: abcd abcd 2. The code fails to compile at line 1 3. The code fails to compile at line 2 4. The code fails to compile at line 4 5. The code can be made to compile by changing line 1 to the following: String o = new String("abcd"); Given answer is '3' but i think correct answer is 3,5. please do verify it. vivek [This message has been edited by Vivek Shrivastava (edited July 29, 2000).]
Joined: Mar 09, 2007
The answer is indeed 3) and 5). 5) is correct, no doubt about it. Chris