what is difference between throw and throws in exception?
Answer Posted / anu mathew
throws:
Method capable of raising an exception but not handling the
same. i.e to say no Try Catch block is implemented in the
Method, to handle the exception.
The callers should create the Try Catch Block to safeguard
against the exception.
If the above is not followed it would result in Compilation
errors.
throw:
The method that raises the exception also handles the same
in its Catch block.
If unhandled the exception can also be handles by the
Callers Try Catch Block.
Hope this makes sense.
| Is This Answer Correct ? | 44 Yes | 10 No |
Post New Answer View All Answers
Why java is secure? Explain.
How do you escape sequences in java?
Does java support function overloading, pointers, structures, unions or linked lists?
What is the final blank variable?
How do you identify independent and dependent variables?
What is method in research paper?
What does t in java mean?
How do you compare objects in java?
Explain about complier design(phases)
What do you understand by java?
give an example for encapsulation?
How can constructor chaining be done using this keyword?
Can we make constructors static?
What is a function argument in java?
What is hashmap in java?