• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jxam

 
Vivek Shrivastava
Ranch Hand
Posts: 277
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Chris Cleverley
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is indeed 3) and 5).
5) is correct, no doubt about it.
Chris
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic