View RSS Feed

Exception

Java Exception

  1. Java Exception Classes

    by , 02-18-2012 at 04:17 PM
    Java exceptions are basically java objects. An object is thrown when you throw a java exception. It is not possible to throw any object as an exception. Only those objects whose classes descend from Throwable.
    Throwable serves as the base class for all classes and it is declared in java.lang. Your program can instantiate and throw it.

    Following picture shows a part of this family.

    Name:  1.JPG
Views: 1088
Size:  19.8 KB
    Java Exception Classes

    As it ...
    Categories
    Exception
  2. Checked and Unchecked Exceptions

    by , 02-18-2012 at 04:14 PM
    Checked exceptions: Programmers are facilitated by checked Exceptions so that to dealings with exceptions which could be thrown. Exception class has sub classes. Checked Exception examples are:

    • Arithmatic exception

    In a method when checked exception takes place, either program caught it or it passes to caller program.

    Unchecked exceptions: They are RuntimeException. Class Errors and subclasses of it are also unchecked.

    Example: ArrayIndexOutOfBounds ...
  3. Java Exceptions

    by , 02-18-2012 at 04:12 PM
    Any unexpected, abnormal & extra-ordinary condition which occurs in Java program at runtime is known as Exception. Examples of events or conditions are as following:

    • Not able to get the “connection exception”
    • “File not found” exception

    In all these conditions, throw an exception object. Such exceptions are considered to be the Java objects. A java error exception can’t be escaped.

    Error conditions are being handled by the Java Exception ...
    Categories
    Exception
  4. Generics - Exceptions

    by , 11-29-2011 at 03:35 AM
    Due to erasure, exception use is limited with generics. As exceptions are know at both compile and at run time, it renders redundant the use of catch clauses. This also means that a generic class cannot inherit directly or indirectly from Throwable.

    One can though use type parameters in the throws clause of a method declaration. This will allow you to write generic code that varies with the type of a checked exception:

    Java Code:
    import java.util.List;
    
    public interface
    ...