File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt in new exam question" Watch "doubt in new exam question" New topic
Author

doubt in new exam question

Bhuvana Dhruva
Greenhorn

Joined: Sep 11, 2000
Posts: 28
hi,
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. }
8.}
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?


Bhuvana
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.
Regards
sanjeev
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubt in new exam question