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
What happens to a static var that is defined within a method of a class?
Difference between error and exception
what is aggregation in java?
When do we need to use internal iteration? When do we need to use external iteration?
What are heterogeneous objects?
Why do we need singleton class?
What is parsing and its types?
What is the size of integer?
Explain the pointers in Java?
Explain with example the concept of constant variable in java.
Why do we need array in java?
Is alive in java?
What is the difference between serial and throughput garbage collector?
What is the purpose of using bufferedinputstream and bufferedoutputstream classes?
If a method is declared as protected, where may the method be accessed in java programming?