what is difference between throw and throws in exception?

Answer Posted / manu

throw: It is used to explicitly or manually throw an
exception.it can throw user defined exceptions.

throws:It tells that exception to b handled by calling
function. It tells caller that what exception that method
could throw.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does split function do in java?

539


Explain the difference between abstract classes and interfaces in java?

602


What is a class component?

617


What is the use of generics? When was it added to the Java development Kit?

560


What are the two basic ways in which classes that can be run as threads may be defined?

554






Why do we need strings in java?

529


Can we have any other return type than void for main method?

542


What is the class in java?

565


What are the advantages of functions?

524


why would you use a synchronized block vs. Synchronized method? : Java thread

537


What is the escape character in java?

517


What are the differences between abstract class and interface?

515


What is the meaning of variable in research?

562


What type of value does sizeof return?

543


What are the benefits of java?

577