Tech Me More

To quench our thirst of sharing knowledge about our day to day experience & solution to techincal problems we face in our projects.

Advertise with us !
Send us an email at

Monday, February 17, 2014

OCJP practice question

E. The code compiles fine, so C is incorrect. The used field initializes to false and the make field initializes to null for the new Vehicle v. Therefore, line 7 is false and line 10 executes. Because v.make is a null reference, attempting to invoke its length method results in a NullPointerException at runtime. Therefore, the answer is E. 

1 comment:

Unknown said...