O'Reilly logo

The class of Java by Pravin Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 11

Exceptions

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required