Abstract
Errors do happen in a computer program. Generally speaking, there are two kinds of possible errors in a program. One kind happens due to problems originating from the execution environment, such as running out of memory, and is represented in Java by the class Error and its subclasses. The second kind of error, called an exception, happens due to problems originating inside the application itself, and is represented by the class Exception and its subclasses. When an exception happens, either there is code to handle it or it is ignored. If it is ignored, the program terminates. However, Java offers an extensive mechanism to handle exceptions. When an exception happens, the exception propagates, changing the normal execution control flow of the application. In other words, exceptions are the messengers that carry the bad news inside the world of an application. Programmers may use the exception-handling mechanism of Java to write well-behaved, robust Java applications.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2006 Paul Sanghera, Ph.D.
About this chapter
Cite this chapter
(2006). Exceptions and Assertions. In: SCJP Exam for J2SE 5. Apress. https://doi.org/10.1007/978-1-4302-0173-1_7
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0173-1_7
Publisher Name: Apress
Print ISBN: 978-1-59059-697-5
Online ISBN: 978-1-4302-0173-1
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)