what is difference between throw and throws in exception?

Answer Posted / chandra sekhar

In Throws, what ever the exception you are declaring are
handle by JVM. If it is a user defined exception in throws
block, JVM doesn't know when to throw that exception. For
this purpose we use Throw for a certain conditions/logic to
throw these user defined exceptions.

I think the above makes sense.

Is This Answer Correct ?    45 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does map works in java?

507


If an application has multiple classes in it, is it okay to have a main method in more than one class?

534


Why char array is preferred over string for storing password?

582


Explain how can you debug the Java code?

586


Can main() method in java can return any data?

641






What is args length in java?

659


Can we create a class inside a class in java?

540


what is use of functional interface in java 8?

554


Explain about object oriented programming and its features?

590


Is there a case when finally will not execute?

563


How do I get 64 bit java?

520


What are the methods used to implement for the key object in the hash map?

561


How do you find the independent variable?

508


Explain the scope of a variable.

625


Difference between character constant and string constant in java ?

554