aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes a question about catch exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "a question about catch exception" Watch "a question about catch exception" New topic
Author

a question about catch exception

feng lee
Ranch Hand

Joined: Oct 29, 2002
Posts: 33
if a method throws an ProtocolException(subclass of IOException) which of the following can be used in declaring that method
a. public void method() throws Exception
b. public void method() throw Exception
c. public throws IOException void method()
d. public void method() throws IOException.
e. public void method() throws ProtocolException.
an ,e.Why a is not right?
Don Bosco
Ranch Hand

Joined: Oct 31, 2002
Posts: 108
Originally posted by feng lee:
if a method throws an ProtocolException(subclass of IOException) which of the following can be used in declaring that method
a. public void method() throws Exception
b. public void method() throw Exception
c. public throws IOException void method()
d. public void method() throws IOException.
e. public void method() throws ProtocolException.
an ,e.Why a is not right?

u bet. a,d and e are correct.


SCJP 1.4<p>Wingardium Leviosa!!
Steve Leung
Greenhorn

Joined: Dec 05, 2002
Posts: 3
Hello,
It seems depend on the method we implement is override the a method or superclass of that class. If we implement subclass of that class, only e is valid.


SCJP 1.4
Shanmugam Karthikeyan
Ranch Hand

Joined: Aug 02, 2002
Posts: 58
Hello please explain it clearly...

i cound't understand your answer
if possible , state some example which justifies your arguments


SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: a question about catch exception
 
Similar Threads
a question about exception
SCJD book: Implementing two Interfaces
Exceptions - Question
applet-servlet communication
IO Exception :Connection timed out