what is difference between throw and throws in exception?

Answer Posted / sathiya moorthy v

throw --> manually throw exception.
Ex: throw ThrowableInstance;
throws -->Any exception that is thrown out of a method must
be specified as such by a throws clause
Ex: <access specifier> <return type> <methodName> throws
Exception{
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you extend main method in java?

630


How to sort elements in a parallel array in java?

508


Can we use string in the switch case?

579


What is the use of parseint in java?

539


How does split work in java?

536






Does list allow duplicates in java?

523


What is the byte range?

584


Can java cast null?

601


Is null an object java?

541


What is the difference between inner class and nested class?

555


What is a percentage sign called?

621


Can you give names of Container classes?

1862


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

1736


Describe 2 different ways to concatenate two strings.

689


How does arraylist work in java?

536