what is difference between throw and throws in exception?

Answer Posted / pavithra

throws is used to throw an exception from the method
without handling that exception where as 'throw' is used
to throw the exception to catch block and handle it.

Is This Answer Correct ?    123 Yes 79 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is void keyword?

669


Why we override equals() method?

562


Is java 11 paid version?

512


Is it possible to specify multiple jndi names when deploying an ejb?

555


What is the intersection and union methods?

546






Are constructors methods?

565


In case of inheritance what is the execution order of constructor and destructor?

635


Can inner class have constructor?

546


What happens if an exception is not handled in a program?

623


What does the @override annotation do?

561


Is .net better than java?

552


What is use of set in java?

488


How do you escape a string?

504


What is the use of arraylist class in java?

555


What are the methods available in a class?

585