• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception  RSS feed

 
Aruna Balasuriya
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will happen when main method throws a exception.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what happened when you tried it?
 
Aruna Balasuriya
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is when we call a method that throws a exception we have to handle it. When main method throws a exception who handles it.
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aruna:

Why don't you try it, and find out?

John.
 
Aruna Balasuriya
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John de Michele wrote:Aruna:

Why don't you try it, and find out?

John.


Kindly tell me how do I find out it.
 
John de Michele
Rancher
Posts: 600
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aruna Balasuriya wrote:Kindly tell me how do I find out it.


1. Create a class with a main() method
2. In the main() method, have it throw an exception
3. Run the class

John.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!