wood burning stoves 2.0*
The moose likes Mock Exam Errata and the fly likes Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
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: 810
error will be due to accessing a[1][0]; ?

becuase thee is no element in the sub-array ?


Thanks and Regards, 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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question "Declare long arrays" in MasterExam downloadable free with purchase of S&B
 
Similar Threads
K&B Exam - incorrect answer?
exam lab gc question
Possible error in Master Exam...
Passing an Array Reference
K & B mock exam question typo