Gil Shoam wrote:Thanks for your answer but it didn't really answer my question.
With try/catch I define what happens in case of an exception. (for example i can print "an exception occured"). In this case (main throws) what actually happens? what does the program do?
Well, I do not see any try/catch block in your code. Place your try/catch block in the code, try executing the code and repost for further queries.
As answered by Jeff, the jvm is currently doing the exception handling. You can speicfy the behaviour of the application/code in case of exception by using the catch block.