February 25, 2008 at 5:58 PM
throw keyword. it is used to user rethrow Exception to caller.its at a time only one exception we can throw.But throws key word is method signature level it will be send multible Exception to the caller
void meth() throws IOException,ServletException
new throw("user Exception message");
February 26, 2008 at 12:09 PM
Difference between throw and throws
throw is used to throw an exception manually, where as throws is used for checked exceptions, to re-intimate the compiler that we have handled the exception. So throws is to be used at the time of defining a method and also at the time of calling that function, which rises an checked exception it gives the compile time error. Use throws to define our own exception or handle the exception the exception by try-catch, otherwise it gives the compile time error.