Naveen Megharaj wrote:how to know whether an Exception is a Runtime exception or Compile time exception....? How to differentiate between them......?its confusing me a lot.......!!!
If i am not wrong then the answer would be:
The
Java programming language provides three kinds of throwables : checked exceptions, runtime exceptions, and errors.
You should use checked exceptions for conditions from which the caller can reasonably be expected to recover.
From the JLS: "This compile-time checking for the presence of exception handlers is designed to reduce the number of exceptions which are not properly handled."
If you are throwing an exception for an abnormal condition that you feel client programmers should consciously decide how to handle, throw a checked exception. Unchecked exceptions indicate software bugs. Precisely because unchecked exceptions usually represent software bugs, they often can't be handled somewhere with more context.
A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Unchecked exceptions are RuntimeException and any of its subclasses. Class Error and its subclasses also are unchecked.
You can find more information
here