What is the difference between throw and throws?

Answer Posted / balaji

throw:it is used to raise exception explicitly
that means it is use when a user defined exception is raised

throws:if a method is capable of throwing an exception but
it does not handle the exception that must be specified by
using "throws" class

Is This Answer Correct ?    23 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the role of garbage collector in java?

483


What is a private class in java?

501


Why heap memory is called heap?

578


What is an array length?

490


Describe different states of a thread.

570






Explain how to convert any java object into byte array.

539


What is the private method modifier?

566


Are arrays classes in java?

522


How can a gui component handle its own events?

586


What is the impact of declaring a method as final?

553


How do you sort in descending order in java using collections sort?

484


What is string in java is it a data type?

527


What is collection api?

602


How do you access command-line arguments within the code?

563


How large is a boolean?

546