what is difference between throw and throws in exception?
Answer Posted / balu
throws clause is used when the programmer does not want to handle the exception and throw it out of a method.
throw clause is used when the programmer wants to throw an exception explicitly and wants to handle it using catch block hence throw and throws are contradictory.
throw clause can be used to throw our own exceptions also i.e user-defined exceptions.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the differences between stringbuffer and stringbuilder?
How would overload a function based on return type?
Can you instantiate the math class?
What is oops in java?
What is difference between iterator access and index access?
What do you meant by active and passive objects?
What is a parent class in java?
What is Java Package and which package is imported by default?
What is the difference between checked exception and unchecked exception?
In which order the iterator iterates over collection?
What is unicode datatype?
What does function identity () do?
Is integer passed by reference in java?
what is function overloading in java?
What is treeset and treemap in java?