What is the difference between throw and throws?

Answer Posted / surender kannuri

throws clause is used to whenever programmer doesn't want to
handle exception.throws it out of method.

throw is used whenever programmer wants to handle exception
explicitly by using catch blocks.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data structure in java?

539


What is the purpose of interface?

586


Can we assign null to double in java?

552


Do you need to import math in java?

565


How does hashmap work in java ?

545






In java how do we copy objects?

554


What is a function easy definition?

529


What exactly is methodology?

489


What are namespaces in java?

527


What is synchronization and why is it important in java programming?

473


Can finally block be used without a catch?

548


Name four container classes.

559


What is unmodifiable collection in java?

514


What is passing value java?

512


When throw keyword is used?

592