File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Jxam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Jxam" Watch "Jxam" New topic


Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
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:
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.
[This message has been edited by Vivek Shrivastava (edited July 29, 2000).]
Chris Cleverley

Joined: Mar 09, 2007
Posts: 22
The answer is indeed 3) and 5).
5) is correct, no doubt about it.
I agree. Here's the link:
subject: Jxam
It's not a secret anymore!