by Dinesh Thakur Category: Exception Handling

Exceptions:- Exception is a condition Which is Responsible for Occurrence of Error Like Divide by Zero is an condition that never be possible So we can call it an Exception which halts or stops the Execution of Program In java there is an Exception Class Which is Responsible for producing an Error Message when an Error has occurred. 



 
by Dinesh Thakur Category: Exception Handling

Java is a general-purpose, object-oriented programming language. We can develop two types of Java programs :

 
by Dinesh Thakur Category: Exception Handling

We Know that java provides us the facility for both creating CUI and GUI Programs All the Previous Topics are Related with the CUI But Applets Provides the ability to user for creating Graphical Programs Like Creating Buttons, Creating Events such that Executing the Code when a user Clicks on Button Etc. There are two type of Applets Like Stand Alone or either Local Applets.



 
by Dinesh Thakur Category: Exception Handling

The main advantages of the exception-handling mechanism in object oriented programming over the traditional error-handling mechanisms are the following:

 
by Dinesh Thakur Category: Exception Handling

Exception handling in Java is accomplished by using five keywords: try, catch, throw, throws and finally.

In Java, the code that may generate (or throw) an exception is enclosed in a try block. The try block can be followed immediately by one or more catch blocks with a finally block as the last block. The try block can also end without a catch block, and the catch blocks need not always have finally as the last block.

 
by Dinesh Thakur Category: Exception Handling

There might be situations in your program where you want to both catch an exception in your code and also want its caller be notified about the exception. This is possible by rethrowing the exception using throw statement.

 
by Dinesh Thakur Category: Exception Handling

A java exception can be thrown only in the following three scenarios:

 

(1) An abnormal execution condition was synchronously detected by the Java virtual machine.



 
by Dinesh Thakur Category: Exception Handling

So far we have been using just single try statement. However, it is possible to nest a try statement inside another try statement. If one try block does not have a corresponding catch block that handles the exception, Java will search the next outer try block for a catch block that will handle the exception, back through successive nesting. If the Java cannot find the catch block for the exception, it will pass the exception to its default exception handler.

 
by Dinesh Thakur Category: Exception Handling

ArrayStoreException is thrown when ever we storing something in an array. If we store wrong type object into an array then this will be thrown. Here is the Java example which explains this.

 
by Dinesh Thakur Category: Exception Handling

Many Times a  Program has to face some errors An Error is an Situation when a Compiler either doesn’t Execute  statements or either Compiler will Produce Wrong Result .Various types of Errors are there like :-

 

Page 1 of 3

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content