aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Checked and JVM Exceptins 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 "Checked and JVM Exceptins" Watch "Checked and JVM Exceptins" New topic
Author

Checked and JVM Exceptins

Siri Naray
Ranch Hand

Joined: May 19, 2006
Posts: 105
Hi Ranchers,
I am so confused with the Exception types. Can someone help me.
Are JVM Exceptions Checked Exceptions?? and Programatically Thrown Exceptions Unchecked ???

In K&B there is a table with a list of JVM and Program Exceptions. but why not a table for Checked and Unchecked Exceptions(thought not all can be listed but some bsic ones)?? Are JVM and Programatically thrown Exceptions different from Checked and Unchecked??

I have my exam scheduled day after. So any help is really apprecited.
Thank You


If you worry you cannot work... If you work you need not worry
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Well there are two types of exceptions.

The first one are the ones that are thrown by some sort of mistake in programming. Like ArrayIndexOutOfBoundsException or ArithmeticException. These exceptions can be prevented by some changes in the code. These are unchecked.

The second are the ones which are related to some kind of resources used by the program like Files or Network connections. These connections are not in the control of the programmer but they are checked so that you could take some action when they occur.

The third are the one that are internal in the JVM. They are caused by some problem during the execution of the program. The are suffixed with Error instead of Exception. They are unchecked as you cannot do anything when they occur...examples are StackOverflowError, OutOfMemoryError etc..

Best of Luck for the Exam dude....


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Arun Krishnan Nair
Greenhorn

Joined: Aug 14, 2008
Posts: 18
Checked exceptions are subclasses of Exception class, JVM exceptions are subclasses of RuntimeException class. I guess when you receive a JVM exception it will be occuring at runtime. So NullPointerException, ArrayIndexOutOfBoundException etc are unchecked JVM exceptions.


SCJP 5 - 100%
Aiming for SCBCD 5 & SCWCD 5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

"Arun", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

I think that JVM Exceptions is a confusing term. All the exceptions are thrown by the JVM. Programmatic exceptions are explicitly thrown using throw. Other exceptions are thrown at runtime automatically...
Brij Garg
Ranch Hand

Joined: Apr 29, 2008
Posts: 234
Programatically throwm exceptions are exception which are programed to be thrown by methods in APIs using throws keyword.

Example:-
public static int parseInt(String s) throws NumberFormatException

Above is the signature of the parseInt method in Integer class.

Programatically Thrown Exceptions can be checked and unchecked exceptions.

JVM thrown exceptions are not programed in APIs ...........I think I am correct here.
Siri Naray
Ranch Hand

Joined: May 19, 2006
Posts: 105
thank you everyone but I am still not clear.
Let me put the question like this.
Out of all the exceptions listed in pg 370 K&B ie.
ArrayIndexOutOfBoundsException
ClassCastException
NullPointerException
ExceptionInitializerError
StackOverFlowError
NoClassDefFoundError
IllegalArgumentException
IllegalStateException
NumberFormatException
AssertionError

any of these come under Handled Or Declare category??
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

All of them are unchecked.
Siri Naray
Ranch Hand

Joined: May 19, 2006
Posts: 105
Hi Ankit,
Thank you. that solves my problem.
I was wondering, you answer almost all questions anytime of the day. Are you done with your SCJP??

Thanks
Sirisha
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

No man....I am stuck heavily with Generics. I don't know why it doesn't seem to get into my mind...I am a Java EE developer. So usually I get very little time to study. Maybe that's the reason why I am not able to understand generics because I have not written too much of code for that....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checked and JVM Exceptins