Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes warning in finally Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "warning in finally" Watch "warning in finally" New topic

warning in finally

pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182

the above is giving this error
warning: finally clause cannot complete normally
1 warning
can any1 plz explain this
(Adding code tags - which I just love doing)
[ April 20, 2004: Message edited by: Barry Gaunt ]

Thanks,<br />Pallavi
Dan Andrei
Ranch Hand

Joined: Jan 21, 2004
Posts: 92
its just a warning not an error, the code compiles
If your question IS WHY DOES IT GIVE A WARNING ?
I,ll try a long shot here:
the finally block must comlplete before the method retruns. The compiler sees a return which means abnormal completion, so it barks a warning.
If some stement was after the return it would give a compile error

"Did anyone understand what I have just explained? ... because I did not!"
pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
abnormal completion due to return in finally or try
K Patel

Joined: Mar 29, 2004
Posts: 7
Whats your version of JDK? I have no warnings popping up when I compiled and
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
I too do not get any warnings...

Kaustubh. Mumbai, India.
Erwin Morales

Joined: Feb 26, 2004
Posts: 8
With Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode) there are this warning of Pallavi, wich is your compiler K and Kaustubh?.
Pallavi, your abnormal completion is due a finally in the method start, it's a first code block in execution and the finally 'almost' always execute

Erwin Morales<br />Ciudad de Mexico/Mexico City
I agree. Here's the link:
subject: warning in finally