What is the difference between throw and throws?
Answer Posted / senthil nathan
throws: If a method is not capable of handling the raised
exception and it wants the caller of the method to
handle the exception means then the method uses the
"throws" keyword... The exception raised here is
of System Exception not User Exception...
throw: If the method is capable of handling the exception
by using try&catch block then this method uses the
"throw" keyword.. It is also used to raise our own
exception.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is boolean data type in java?
What is meant by inheritance and what are its advantages?
What is a variable simple definition?
Can we use static class instead of singleton?
What happens to the Exception object after handling an exception?
What is the final keyword in java?
What is the file type?
What is the difference between math floor and math round?
How is treeset implemented in java?
What are methods?
Explain wrapper classes in java?
what is difference between equals and ==?
What is java full form?
What is mean by exception?
explain the concept of virtual method invocation in polymorphism in detail?