wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt in new exam question 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 "doubt in new exam question" Watch "doubt in new exam question" New topic

doubt in new exam question

Bhuvana Dhruva

Joined: Sep 11, 2000
Posts: 28
check out this ?

1. Given:
1.public class ArrayTest {
2. public static void main (String[] args) {i
3. Object[] ov;
4. String[] sa = { "Green", "Blue", "Red" };
5. ov = sa;
6. System.out.println("Color = " + ov[1];
7. }
What is the result?
A.fails to compile
B.prints Color=Blue
C.prints Color=Green
D.generates an exception at runtime

this code does not compile because of an extra i in line2. so the ans should be A and not B as given in the website. am i not right?

Sanjeev Verma
Ranch Hand

Joined: Aug 24, 2000
Posts: 87
Dear Bhuvana
technically speaking, you are right. It is a typo on the part of the writer. But if you remove the typo, the answer is B. Just hope there are no Qs like this on the real exam. Gives me the jittersssssssss.
I agree. Here's the link: http://aspose.com/file-tools
subject: doubt in new exam question
It's not a secret anymore!