CodesJava

Easy learning with example program codes

what is the use of throws keyword in java?


throws is used to throw an exception object implicitly. It is used with the method signature. More than one type of exception can be declared with method signature, they should be comma separated.

Note:
1.     throws is mainly used to throw checked exception.
2.     If you are calling a method that declares an exception, you must either caught or declare the exception.
3.     We can rethrow the exception.

Syntax:

methodName () throws comma separated list of exceptionClassNames{}

 

Java interview questions on exception handling

Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki