File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Notes on checked/unchecked exceptions--need assistance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Notes on checked/unchecked exceptions--need assistance" Watch "Notes on checked/unchecked exceptions--need assistance" New topic

Notes on checked/unchecked exceptions--need assistance

Dave Reinhardt
Ranch Hand

Joined: Aug 07, 2006
Posts: 54
I'm trying to go thru the SCJP book and also the Sun exam objectives and organize some notes on the subject of exceptions. All the exceptions listed in the objectives seem to be unchecked exceptions (they are subclasses of RuntimeException or Error). I see nothing listed on direct subclasses of Exception, so I'm wondering which checked exceptions were are supposed to know for the exam. Can anyone help or refer me to some notes on exceptions?

Here's what I have so far:

java.lang.Object <-- Throwable<--Exception <-- RuntimeException
java.lang.Object <-- Throwable<--Error

Checked: ClassNotFoundException, DateFormatException, InterruptedException, IOException, NoSuchFieldException, NoSuchMethodException

Unchecked: RuntimeException, ArithmeticException, ClassCastException, IllegalArgumentException<--NumberFormatException, IllegalStateException, IllegalMonitorStateException, IndexOutOfBoundsException<--ArrayIndexOutOfBoundsException, NullPointerException, Error<--AssertionError, Error<--LinkageError<--ExceptionInInitializerError, Error<--VirtualMachineError<--StackOverflowError, Error<--LinkageError<--NoClassDefFoundError.

from Sun:
"Understand which of these are thrown by the virtual machine and recognize situations in which others should be thrown programatically."
I've read the section on this in K&B, and am still fuzzy on the concept, if someone could provide some clarity I'd appreciate that.

Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3635
The checked exceptions that you should know about for the exam are basically the ones that are part of the API covered in the exam.

For example, since the exam covers I/O, it is imperative that you should know about IOException and FileNotFoundException. Or Thread.sleep -> InterruptedException.

In general, we haven't seen anybody getting a question that required specific knowlegde of any particular exception (except the ones listed in objectives).

Understanding of exceptions is important for determining correct method overriding, try/catch rules, and general program control flow. If a question is testing you on overriding, it will be clear enough for you to know that the base class method is throwing a checked exception. So if you understand that, you don't really need to worry about actual exception classes.

Enthuware - Best Mock Exams and Questions for Oracle Java Certifications
Quality Guaranteed - Pass or Full Refund!
Amit Batra
Ranch Hand

Joined: Mar 04, 2006
Posts: 361
There is a table in the K&B on pg 370. the exceptions listed there you will be explicitly tested on. for ex: they could have a question that accesses a bad array index and ask you what kind of exception will be throw.
Then there are some topics where you will be implictly be tested on. In these questions you will just need to look if its been given a try/catch. these are:

1.)whenever you see a file question,
2.) a serialization question,
3.)In threads a JWS question. JWS being a join, wait or sleep.
4.)parsing using dateformat or numberformat.
All the above throw checked exceptions.
Ofcourse you know about assertion errors.
Dave Reinhardt
Ranch Hand

Joined: Aug 07, 2006
Posts: 54
I agree. Here's the link:
subject: Notes on checked/unchecked exceptions--need assistance
It's not a secret anymore!