Sunday, June 15, 2014

the difference between Throw and Throws in Java Exception Handling

at some point in the method /code tree you can handle a situation by throwing an exception

eg throw new MyFancyExceptionforThisSituationIwantToHandleProperly

up the tree i will catch it with a catch (MyFancyExceptionforThisSituationIwantToHandleProperly e)

and then handle it.

so you can make one enclosing struct to deal with multiple exceptions

like an if but call try catch catch catch catch

i guess they (java deigners, who are devs, who are nerds, who have egos) needed to name it something different to be cool...



No comments:

Post a Comment