Exception Handling --------------------- Q)What are the different kinds of errors that are encountered during the development and execution of Java applications? 1)Compilation errors 2)Runtime errors 3)Logical errors =>Java Compiler reports compilation errors when the syntax of of the source code is not correct. =>When Java runtime environment rules are voilated JVM reports thos errors known as runtime errors. For eg. trying to open a non-extising file =>If the application is giving unexpected/wrong result, we say that there are some logical errors in it. Neither Java compiler reports them nor JVM reports them. Applicatio logic is wrong. Q)What is an exception? =>An abnormal event occured during the execution of a Java application which disrupts the normal flow of the application is nothing but an execption. =>Runtime error is nothing but an exception. =>In Java, an exception is also an object. =>When Java runtime environment rules are violated, JVM raised error is an exception. Q)What are the dangers caused by an exception? =>When an exception is raised application is terminated abnormally. =>Abnormal termination of the application causes the following dangers. 1)user's data/work may be lost 2)user doesn't have information about what went wrong 3)resources given to the application can't be gracefuly released. Q)What is exception handling? =>Exception handling is a mechanism of dealing with exceptions and there by preventing the dangers caused by the exceptions. =>Exception handling makes Java applications robust. Note:- Ability to withstand against failure is nothing but robustness. Q)How does Java support implement exception handling in Java Applications? 1)Language support 2)API support(Library support) =>As far as Java languge support for exception handling is concerned, Java has given 5 keywords. 1)try 2)catch 3)throw 4)throws 5)finally =>As far as API support is concerned, a hierachy of pre-defined exception classes is given.