August 2010
Intermediate to advanced
492 pages
13h 39m
English
During the execution of an application, there are many times when an error condition arises within the application. In Java, all kinds of error conditions are called exceptions. In this chapter, we look at how error conditions can occur during the execution of any of the methods, and how such error conditions may be handled by the invoker of the methods. Exceptions may occur due to various reasons at runtime. It could be due to wrong (unexpected) inputs from the user or non-availability of certain resources, which our code depends on. To understand error conditions, let us start by looking at a simple code segment as given below:
1 int a = 75; 2 int b = 0; 3 int c = a / b;
What happens when the above code segment ...
Read now
Unlock full access