This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problem in Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem in Exception" Watch "Problem in Exception" New topic

Problem in Exception

Irfan Zubair

Joined: Jun 12, 2012
Posts: 17

I don't know why I am getting this error. unreachable statement
1 error

Can anyone tell me why?
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11168

first, let's format this correctly: exactly do you think you can reach line 9? As soon as you throw the exception on line 8, you jump to the finally block on line 11. So there is no possible way for this line to execute. The compiler can tell, and assumes that you made a mistake somewhere.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: Problem in Exception
Similar Threads
explain try catch problem
Overriden exception
unreachable code
Exception error
about try and finally