Exception Handling

Difference between throw and throws keyword?

Difference between throw and throws keyword?

Difference between throw and throws keyword? throw keyword Sometimes we can create exception object explicitly we can handover to the JVM manually. For this, we have to use Throw keyword. Example:- throws new AirthmeticException(“/by zero”); Hence the main objective of Throw keyword is to handover our created exception object to JVM manually. Hence the result of following two programs is ...

Read More »

Difference between final & finally & finalize keyword?

Difference between final & finally & finalize keyword?

Difference between final & finally & finalize keyword? The keyword final is an access modifier, finally is a block and finalize is a method. The keyword final is applicable to the classes, variables and methods of the classes finally is a block associated with the try catch block that is used to handle exceptions, finalize is a method that operates ...

Read More »

What is finally block in Java?

What is finally block in Java?

What is finally block in Java? It is not recommended to maintain cleanup code inside try block because there is no guarantee for the execution of every statement inside the try block. It is not recommended to maintain cleanup code inside the catch block. Because if there is no exception then catch block won’t be executed. Hence we required someplace ...

Read More »

What is Exception and Exception hierarchy in Java?

What is Exception and Exception hierarchy in Java?

What is Exception and Exception hierarchy in Java? Throwable class act as the root for Java Exception Hierarchy. A throwable class defines two child classes Exception Error Exception An unexpected unwanted even that disturbs normal flow of the program is called an exception. It is highly recommended to handle the exceptions and the main objective of exception handling is graceful ...

Read More »

What is the checked and unchecked exception?

What are the checked and uncheched exception?

What is the checked and unchecked exception? The exceptions which are checked by the compiler for smooth execution of the program are called checked exceptions. In our program, if there is a chance of raising checked exception then compulsory we should handle that checked exception either by try-catch or by throws keyword otherwise we will get compile time error. Unchecked ...

Read More »

Explain Default exception handling in Java?

Default exception handling in Java ?

Explain Default exception handling in Java? Inside a method, if any exception occurs the method in which it is raised is responsible to create exception object by including the following information. Name of exception Description of exception Location at which exception occurs(Stack trace). After creating exception object method handover that objects to the JVM. JVM will check whether the method ...

Read More »

Responsive WordPress Theme Freetheme wordpress magazine responsive freetheme wordpress news responsive freeWORDPRESS PLUGIN PREMIUM FREEDownload theme free