• 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 declaration..

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi raghvan..
in case of a checked exception, if none of the method including the main(), handle the exception, instead they only throw the exception, then what will be the result???
 
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,
If main() does not handle the exception then finally JVM will come crashing down and your program will halt abruptly. In below code test.method1() will cause main() to end abruptly and hence the program will terminate.

O/P:
Exception in thread "main" java.io.IOException
at TestClass.method3(TestClass.java:19)
at TestClass.method2(TestClass.java:15)
at TestClass.method1(TestClass.java:11)
at TestClass.main(TestClass.java:7)



I hope this clears.
 
sonia jaswal
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that is stacktrace will be printed!!! fine i just wanted to confirm..... thank you...
reply
    Bookmark Topic Watch Topic
  • New Topic