Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should I know the runtime exceptions for the exam?

 
Marc Wentink
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/RuntimeException.html
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Marc Wentink
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


Thanks,
[ May 30, 2007: Message edited by: Chandra Bhatt ]
 
Matt Russell
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.6
[ May 30, 2007: Message edited by: Matt Russell ]
 
Marc Wentink
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for the information.
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These are the exceptions mentioned in the exam's objectives:


Recognize situations that will result in any of the following being thrown: ArrayIndexOutOfBoundsException,ClassCastException, IllegalArgumentException, IllegalStateException, NullPointerException, NumberFormatException, AssertionError, ExceptionInInitializerError, StackOverflowError or NoClassDefFoundError. Understand which of these are thrown by the virtual machine and recognize situations in which others should be thrown programatically.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic