Senin, 12 September 2016

What is a user-defined exception?

In this article we will learn how to create user defined exceptions (own exceptions) and how to use them in Java programs. Although Java provides several pre-defined exception classes, sometimes we might need to create our own exceptions which are also called as user-defined exceptions. Steps for creating a user-defined exception: Create a class with your own class name (this acts the exception name) Extend the pre-defined class Exception Throw an object of the newly create exception As an example for user-defined exception, I will create my own exception named NegativeException as follows: 1 2 3 4 5 6 7 8 9

The post What is a user-defined exception? appeared first on Coding Security.


What is a user-defined exception?
read more

Tidak ada komentar:

Posting Komentar