Should I know the runtime exceptions for the exam?
Marc Wentink
Ranch Hand
Joined: May 18, 2007
Posts: 142
posted
0
One of the topics of the exam is to be able to see the difference between code involving checked and unchecked or runtime exceptions. But should I actually know what are the RuntimeExceptions, when they are thrown in a program? From the list below I only know NullPointerException. And other Exceptions like IOExceptions I thought would be runtime errors, but appearantly are not.
Yeah you need to know what are programmatically and JVM thrown exceptions. You will have to recognized what exception the given code may throw. List of Exceptions covered in the exam objective can be found Page 370 of K&B.
Thanks,
cmbhatt
Marc Wentink
Ranch Hand
Joined: May 18, 2007
Posts: 142
posted
0
Thanks. Another question about this topic. It seems logical that JVM thrown exceptions are always unchecked RTE, but I cannot seem to put my finger on a text that actually confirms that. It is true though, JVM throwns are pro def unchecked?
Chandra Bhatt
Ranch Hand
Joined: Feb 28, 2007
Posts: 1707
posted
0
It seems logical that JVM thrown exceptions are always unchecked RTE, but I cannot seem to put my finger on a text that actually confirms that. It is true though, JVM throwns are pro def unchecked?
RuntimeException is a class that extends Exception. Any exception that inherits from the RuntimeException is unchecked exception. If your confusion is there is something called compile time exception, that is wrong. Stick to the fact that RuntimeException is a class and this as well any subclasses of this throw unchecked exception.
Unchecked exception just means you don't need to handle or declare that exception where as checked exceptions must be caught or declared otherwise compiler error.
Originally posted by Marc Wentink: Thanks. Another question about this topic. It seems logical that JVM thrown exceptions are always unchecked RTE, but I cannot seem to put my finger on a text that actually confirms that. It is true though, JVM throwns are pro def unchecked?
Yeah, as you say, they pretty much have to be unchecked, otherwise programming in Java would be unbearably annoying! See: