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

Why set is used in java?

573


What are the 5 types of research methods?

589


What is the importance of hashcode() and equals() methods?

583


What is classes in java?

519


Why webdriver is an interface?

585






What is a literal coding?

516


How do generics work?

522


design an lru cache in java?

546


Why is static used?

554


Is integer a class?

570


How many bits is a double?

534


What are access specifiers in java ?

590


Difference between concurrent hashmap and hashtable and collections

568


Which list is sorted in java?

585


If a method is declared as protected, where may the method be accessed in java programming?

498