This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes ExceptionTest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "ExceptionTest" Watch "ExceptionTest" New topic


Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127

hi all,
can anybody suggest and explain whts the output for the above program and how its generated?


( tags and formatted)
[ May 12, 2005: Message edited by: Barry Gaunt ]
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
There will be no output from this program. There is no main method.
Henry Wong

Joined: Sep 28, 2004
Posts: 20538

I don't think program will even compile. The runTest() method is declared to throw a checked exception, which can't happen. The test() method does handle the checked exception or is declared to throw it.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rohan Kayan
Ranch Hand

Joined: Sep 17, 2004
Posts: 123
There will be compilation error the method test should explicitly catch the exception or it should put them in throws caluse .

SCWCD 1.4, SCJP 1.4
I agree. Here's the link:
subject: ExceptionTest
It's not a secret anymore!