In Exception handling,if we want our own exceptions to be thrown we have to extend Exception class or we have to implement throwable interface.I could not understand what is the use of throwable interface.....as it does not specify any methods inside it.So,why we implement Throwable interface?please Explain clearly......Thank u.
There is no "Throwable interface" -- Throwable is actually a class, the parent of "Exception" and "Error". All the useful methods of Exception are actually defined in Throwable; it's "Exception" whose Javadocs suggest that it is an empty class.
When defining an exception, you normally extend Exception or RuntimeException; these are the parent classes of "normal" exceptions that occur during program execution. "Error" is the parent of abnormal error conditions like "out of memory" or "internal error". Although nothing prevents you from extending Throwable directly, it would be a bad practice; normally "catch (Exception ex)" should be able to catch all normal exceptions.
So, are you going to tell us where you heard about this "Throwable interface?"