This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Regarding Exception handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regarding Exception handling" Watch "Regarding Exception handling" New topic
Author

Regarding Exception handling

raj talatam
Ranch Hand

Joined: Apr 19, 2012
Posts: 87

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






[Thumbnail for exception.PNG]

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

The JVM will.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
raj talatam
Ranch Hand

Joined: Apr 19, 2012
Posts: 87
Rob Spoor wrote:The JVM will.


how ???
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18509
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37945
    
  22
It also terminates the thread the Exception occurred in.
 
wood burning stoves
 
subject: Regarding Exception handling
 
Similar Threads
WA #1.....word association
counting algorithm
void return type in JSP expression
why JMX can not stop
Java ranch rules roundup