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

Checked and JVM Exceptins

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Arun", please check your private messages for an important administrative matter.
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All of them are unchecked.
 
Siri Naray
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic