• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

checked/unchecked exception list

 
Ranch Hand
Posts: 44
Eclipse IDE Firefox Browser Java
  • Likes 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,

There is list of exceptions in the KB book that classifes them as thrown by JVM or programmer. However, I could not find a proper list in the book or the forums that classifies them by checked vs unchecked. So I have a compiled a list here of the ones I have encountered in the book and mock exams for you guys to use as a resource. (Enjoy).
If there is any that you have encountered, feel free to add to this list but please limit your responses to your findings in mock exams/KB book only.

Unchecked
ArrayIndexOutOfBoundsException
ClassCastException
IllegalArgumentException
IllegalStateException
NullPointerException
NumberFormatException
AssertionError
ExceptionInInitializerError
StackOverflowError
NoClassDefFoundError

Checked
Exception
IOException
FileNotFoundException
ParseException
ClassNotFoundException
CloneNotSupportedException
InstantiationException
InterruptedException
NoSuchMethodException
NoSuchFieldException
 
Greenhorn
Posts: 12
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Asad, just what I was looking for!
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I remember a simple rule:

if e IS-A RuntimeException, or e IS-A Error, then it is unchecked exception;
otherwise, it is checked exception.

Correct me if I'm wrong.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anayonkar Shivalkar wrote:Correct me if I'm wrong.


You are right.
From JLS:


The unchecked exceptions classes are the class RuntimeException and its subclasses, and the class Error and its subclasses.
All other exception classes are checked exception classes

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More on this topic can be found at

List of Checked and Unchecked Exceptions in Java
 
Marshal
Posts: 75716
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thomas Hauck wrote:. . . List of Checked and Unchecked Exceptions in Java

Unfortunately, that list is only short, and the explanations aren't always very good. It misses out the commonest checked exceptions, e.g. this, and this. Also some of the descriptions make me wonder whether the writer has ever used that exception:-

That List wrote:17. UnsupportedOperationException: An unsupported operation was encountered.

The definition of checked exceptions and unchecked exceptions is to be found in the Java┬« Language Specification (=JLS), which confirms that  Anayonkar Shivalkar was correct, but the class RuntimeException must be high in the list of most confusing class names ever.
If a link tells us that a class was new in Java5, I am going to think the list is oiut of date. Java5 was nearly fifteen years ago.
 
Thomas Hauck
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The updated list can be found at
Checked | Unchecked Exceptions
 
Normally trees don't drive trucks. Does this tiny ad have a license?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic