aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Code execution flow 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 "Code execution flow" Watch "Code execution flow" New topic
Author

Code execution flow

Kedar Dravid
Ranch Hand

Joined: May 28, 2004
Posts: 333
Consider the code below:



O/p: index=2
How is it that line 2 doesn't result in a NullPointerException, since getArray() returns null? Or is it that the NullPointerException is caught in the catch block (which does nothing), and then the value 2 from [index=2] printed?
Kindly correct me if I am wrong.

[ March 08, 2005: Message edited by: Mark Spritzler ]
[ March 08, 2005: Message edited by: Mark Spritzler ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Keder, I edited your post to add the CODE tags, and made the code a bit more readable for everyone.

Good Luck

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
How about printing something in the catch block? Then you will be able to test your hypothesis.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
Don't get me started about those stupid light bulbs.
 
subject: Code execution flow