Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What can be thrown

 
manasa teja
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 Error
2 Object
3 RunTimeException
4 Exception
5 Throwable

Answer given is 1,3,4,5.
Can we throw Error also. Please clarify.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can throw anything that is a subclass of Throwable and that includes Error, of course.
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The correct spelling is "RuntimeException" -- no capital T. Where did you find this question?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic