IntelliJ Java IDE
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Exception" Watch "Exception" New topic
Author

Exception

josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
The object thrown by a throw st must be assignable to
Exception
Error
Throwable//t
String
Alk
Greenhorn

Joined: Feb 02, 2000
Posts: 25
You are Right!!
Alk
josephine chen
Ranch Hand

Joined: Oct 29, 2002
Posts: 216
but Exception and Error both are correct
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
Actually no, it is not correct to say that the object thrown by a throw statement must be assignable to Exception, and it is also not correct to say that the object must be assignable to Error. Each of these statements eliminates the other as a possibility, which is wrong. Only Throwable is correct, because it's the only one that includes all possibilities.
[This message has been edited by Jim Yingst (edited February 21, 2000).]


"I'm not back." - Bill Harding, Twister
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3215
Since the question says must, then Throwable is the only correct answer.
If it had said may or can then Exception and Error would have also been correct.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
 
subject: Exception
 
Threads others viewed
why JMX can not stop
Java ranch rules roundup
counting algorithm
void return type in JSP expression
WA #1.....word association
developer file tools