REGISTER FREE to Receive Instant Job

Friday, 7 November 2014

throws keyword in Java

throws keyword is used to specify the exceptions that can be thrown by method.
Proper signature of method –
Modifier returntype MethodName(Arg list) throws ExceptionList;
Example – 
public static int parseInt(String no) throws NumberFormatException;
Exception can be of 2 types:-

  • Checked Exception are those exceptions which are forced by the compiler either to be properly caught or declared to be thrown.
  • Unchecked exceptions are those exceptions which are not forced by the compiler either to be properly caught or declared to be thrown.

Unchecked exceptions represents either common logical errors or those runtime errors which cannot be programmatically handled.
Error and its subclasses, Runtime and its subclasses are unchecked exception or other are checked.


1 comment:

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.