• Post Reply Bookmark Topic Watch Topic
  • New Topic

throw statement  RSS feed

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was just thinking.. do we always have to throw an object of a class which extends Throwable class or it's subclass Exception?

Thanks.
[ June 14, 2008: Message edited by: Arjun Reddy ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only Throwable and its subclasses (including Exception and Error and their subclasses) can be thrown. Is that what you're asking? You can't throw a String as in C++, for example.
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it.

Thank you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!