• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Exception handling  RSS feed

 
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
Posts: 20898
81
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
Sheriff
Posts: 22853
119
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
Posts: 53779
128
  • 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
Boost this thread!