• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Question on Exceptions

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,

I have a question related to exceptions?I read K&B but still not very clear regarding programatically thrown excetions and exceptions thrown by JVM?Are they even remotely associated to checked and unchecked respectively?Is there any other way to understand them other than learing the names by heart?

Thank You
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Praneeth

Let me try to answer your question briefly:

If user defined exceptions extend RuntimeException then they become unchecked excpetions or else they become checked exceptions. Because only RuntimeException and its subclasses are unchecked exceptions.

You need to remember exceptions only mentioned in K&B book for the exam. They are easy to remember because by the name of the exception itself we can tell in what situations those exceptions will be thrown.

Murali...
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Praneeth

I also faced the same problem.
Programmatically thrown exceptions are the one thrown explicitly from your code.
It can be both checked or unchecked as said by Murali.

Amit
 
praneeth kumar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.I will keep this in mind and read K&B again.Hope I will understand this time.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic