• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception

 
V Bose
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

True or False-
Assuming Line 6 throws a FileNotFoundExcepton, Would line 13 throw a Null Pointer exception?
OR if things go fine up until Line 12 and Line 13 throws an IOException, will the JVM stop with an IOException?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IOExceptions will never force the JVM to stop because it is a checked exception and must be handled somewhere by your program in order to even be compiled and run. As for the NullPointerException: you should check to see if it is null and open before you attempt to close it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic