Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes finally clauses and different JVM's 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 "finally clauses and different JVM Watch "finally clauses and different JVM New topic

finally clauses and different JVM's

Joseph Maddison
Ranch Hand

Joined: Nov 04, 2004
Posts: 53
From the following link, link it is clear that what is allowed in a finally clause depends on whether or not the JDK is 1.4.2 or later.

Prior to 1.4.2, finally clauses could have a return statement in them. Now, they give a compile error: warning: finally clause cannot complete normally.

The answer seems to be that a finally clause can not return a value, unless java.lang.Throwable is caught. My question is, is this particular nugget of information something on the SCJP Exam?

It would be important to know, especialy since it does not appear to be mentioned anywhere in the study guides I've looked at, including the Osbourne Java 2 Study Guide related to this web site.


(fixed link, I hope)
[ November 04, 2004: Message edited by: Barry Gaunt ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I don't think you will see such a question on the current SCJP. But if you did, then I suggest you go with the pre-1.4.2 choice of answer.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: finally clauses and different JVM's
It's not a secret anymore!