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

What happens to a static var that is defined within a method of a class?

797


Difference between error and exception

5501


what is aggregation in java?

777


When do we need to use internal iteration? When do we need to use external iteration?

852


What are heterogeneous objects?

812


Why do we need singleton class?

755


What is parsing and its types?

798


What is the size of integer?

848


Explain the pointers in Java?

821


Explain with example the concept of constant variable in java.

894


Why do we need array in java?

758


Is alive in java?

728


What is the difference between serial and throughput garbage collector?

808


What is the purpose of using bufferedinputstream and bufferedoutputstream classes?

823


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

721