Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Exception handling

 
raj talatam
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

who will handle if we throw an exception out of main() by using throws




exception.PNG
[Thumbnail for exception.PNG]
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM will.
 
raj talatam
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:The JVM will.


how ???
 
Henry Wong
author
Marshal
Pie
Posts: 21194
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rajendar talatam wrote:
Rob Spoor wrote:The JVM will.


how ???



It's just what it does. The main thread of the JVM is responsible for calling the main() method, and if the method "returns" with an exception condtion, the default uncaught exception handler for the main thread just does a stack trace -- not much handling in my opinion, but handles it regardless.

Henry
 
Campbell Ritchie
Sheriff
Pie
Posts: 49382
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It also terminates the thread the Exception occurred in.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic