what is difference between throw and throws in exception?
Answer Posted / ajay
Throws keyword suggests that the particular method contains
an Exception and that uncaught Exception is thrown to be
next class where it is supposed to handle(i.e.to be by next
user as he want to handle that exception in his own
way).Simply it throws uncaught exception.But Throws keyword
is used to throw only checked Exceptions and avoids compile
time errors.
And throw keyword,which is used in case of manual
Exception,throw object of corresponding exception from try
to catch just like java implicitely does in cases other than
manual Exception.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are pass by reference and pass by value?
Explain notify() method of object class ?
Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?
How do you include a string in java?
What is tree node in java?
Why is java architectural neutral?
Java.util.regex consists of which classes?
What is the use of static class?
What is variable and example?
What is the use of coding?
Difference between final and effectively final ?
Why to use nested classes in java?
What is the maximum size of byte array in java?
How do you check if a number is a perfect square?
What are the drawbacks of reflection?