This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes regarding reachable and unreachable statements. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "regarding reachable and unreachable statements." Watch "regarding reachable and unreachable statements." New topic

regarding reachable and unreachable statements.

Karthikeyan Ganesh Sarma

Joined: Mar 08, 2001
Posts: 7
Hello everybody,
I've got a simple doubt regarding reachable and unreachable statements. can anyone explain me the difference between the two as i am pretty confused with the logic. For ex if i execute the following code....

if i execute the above code i get a comple error at line 2 saying the line is unreachable...but if interchange both line 1 and 2 it works fine. can anyone throw light on this.Thanks in advance.
Rajeshwari Natarajan
Ranch Hand

Joined: Mar 05, 2003
Posts: 67
At line 1 in the catch bloack u have a return statement, which effectively trasnfers control out of the method so line 2 is not reachable.

regards<br />Rajeshwari. N
I agree. Here's the link:
subject: regarding reachable and unreachable statements.
It's not a secret anymore!