• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handle and declare as opposed to handle or declare  RSS feed

 
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Why is it that I have to handle and declare an exception if I am re-throwing it in a catch block as opposed to just handle or declare which is the usual case?
 
Marshal
Posts: 58302
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look on “or” as meaning, “inclusive or” rather than, “inclusive or”.
Consider that your new Exception which you are throwing is different from that you are catching, so it needs a new declaration.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm.. That explains it.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!