• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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.
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic