• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception Handling

 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Under this link

http://java.sun.com/docs/books/tutorial/essential/exceptions/definition.html

I donot understand the call stack,

The call stack shows if some exception occured in main method, it will
call the method with exception handler, then once it got the method with exception handler then why it call the method without an exception handler.
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The output with the call stack is as follows:


The method that gets called first will go to the bottom of the stack. Here in this case it is main and other methods follow in the calling order. When an exception is thrown the control will go backwards in the call stack looking for the method that has the exception handler, if none found, it will be passed out of main which results in JVM crashing.

[ April 12, 2007: Message edited by: M Krishnan ]
[ April 12, 2007: Message edited by: M Krishnan ]
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot Krishnan
reply
    Bookmark Topic Watch Topic
  • New Topic