Posted By:
Stephen_McConnell
Posted On:
Friday, April 18, 2003 05:23 AM
One compiles a java program to get a class file which executes. You get compile
Errors then. These are separate from
Runtime Errors and
Exceptions
If you look at the Java Docs for any one of the versions of the SDK found on the Sun site; and check out the java.lang package, you will notice both Runtime Errors and Runtime Exceptions! This can be confusing.
You can use the exception handling of a
try{
// code to test
}catch(){
// error/exception handling stuff.
}
to process both Runtime Errors and Exceptions.
Looking at the JavaDoc; and comparing the difference between Errors and Exceptions, you might notice that the Errors usually have to do with something that has happened in the hanling of Class Loading or something that the JVM cannot handle. Exceptions usually happen because of a coding error...
How to handle errors and exceptions has been the topic of dozens of artiles and books. I would suggest looking at the archives in the Javaworld site. It is a great resource for all things java; and has good articles on the stuff that is cutting edge...
Hope this helps.
Stephen McConnell