wood burning stoves 2.0*
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
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: http://aspose.com/file-tools
subject: regarding reachable and unreachable statements.
Similar Threads
Traps to be aware of in any SCJP test !!!!! :)
finally in try/catch Mock exam
unreachable code in 'finally'
Exception ??