What is the difference between throw and throws?

Answer Posted / ranganathkini

The 'throw' statement initiates an exception to be thrown
where as the 'throws' clause declares that the method is
expected to throw 1 or more checked execptions.

Is This Answer Correct ?    43 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is string pool?

623


What types of index data structures can you have in java?

608


What are the steps that are followed when two computers connect through tcp?

515


Difference between ‘is-a’ and ‘has-a’ relationship in java?

533


What are the types of exceptions?

587






What do you understand by private, protected and public?

513


How many digits is int32?

534


How is garbage collection controlled?

725


When parseint method can be used?

533


How do you define a method?

507


Can a source file contain more than one class declaration?

508


Why are parameters used in functions?

525


Do I need to import java.lang package any time? Why?

733


Difference between throw and throws?

614


Does a class inherit the constructors of its superclass in java programming?

519