aspose file tools*
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
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: 80

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: 19544
    
  16

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: 80
Rob Spoor wrote:The JVM will.


how ???
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18120
    
  39

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: 36514
    
  16
It also terminates the thread the Exception occurred in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding Exception handling
 
Similar Threads
counting algorithm
void return type in JSP expression
why JMX can not stop
Java ranch rules roundup
WA #1.....word association