This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes regarding Throwable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "regarding Throwable" Watch "regarding Throwable" New topic
Author

regarding Throwable

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
when i write throw new Throwable(),it is working.I wonder how we can write new in front of an interface because Throwable has no constructor,so how it is possible.Any comments.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Throwable isn't an interface, it's a class.

You are correct in your idea that you cannot instantiate an interface directly. But this is not relevant to Throwable, as it's a class.

Note that you should never instantiate Throwable directly, in any real application. It is legal Java to do so, but very bad practice. You should only instantiate Exception, RuntimeException or Error, or (better) their subclasses.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Majid Al-Fifi
Ranch Hand

Joined: Aug 22, 2006
Posts: 45
I also thought Throwable is an Interface.

regards,
Majid


SCJP1.4, SCWCD1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding Throwable