• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Catching or declaring exception doubt.

 
Rahul Choudhary
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


When I try compiling it gives error saying "unreported exception, must be caught or declared to be thrown".

Isn't this line declaring the exception so why the error?


If I'm missing out any statement please highlight it. Thanks.
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the catch-or-specify requirement applies to the raise() method, why wouldn't it also apply to the main() method?
 
Rahul Choudhary
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just compiled and checked works! Thanks Jelle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic