File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes Question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Mock Exam Errata
Reply Bookmark "Question "Declare long arrays" in MasterExam downloadable free with purchase of S&B" Watch "Question "Declare long arrays" in MasterExam downloadable free with purchase of S&B" New topic
Author

Question "Declare long arrays" in MasterExam downloadable free with purchase of S&B

Dave Alkire
Greenhorn

Joined: Jun 25, 2004
Posts: 10
Something went totally wrong with this question, "What is the result?". You can see that this compiles fine despite their claim, but instead there's a runtime exception:

:roll:


-Dave A.
H Singh
Ranch Hand

Joined: Apr 03, 2005
Posts: 34
Yes, the answer is wrong.
It will cause a NullPointerException and not a compiler error.

HS
amit taneja
Ranch Hand

Joined: Mar 14, 2003
Posts: 797
error will be due to accessing a[1][0]; ?

becuase thee is no element in the sub-array ?


Thanks and Regards,<br />Amit Taneja
Dave Alkire
Greenhorn

Joined: Jun 25, 2004
Posts: 10
becuase thee is no element in the sub-array ?


Yeah, I think it's that the second dimension is declared but not initialized; that is, the compiler doesn't care because it knows that there's an array of longs, but then the jvm gets confused because it doesn't know how many there are supposed to be; so it's trying to use something that hasn't been fully defined.
[ June 08, 2005: Message edited by: Dave Alkire ]
 
 
subject: Question "Declare long arrays" in MasterExam downloadable free with purchase of S&B
 
Threads others viewed
K & B mock exam question typo
Possible error in Master Exam...
Passing an Array Reference
K&B Exam - incorrect answer?
exam lab gc question
MyEclipse, The Clear Choice