what difference between throw and throws in exception
handling.
Answer Posted / aravinda reddy
Whenever we want to force an exception then we use throw
keyword,throw keyword can also be used to pass a custom
message to the exception handling module i.e. the message
which we want to be printed. throw we will use at statement
level.
Whereas when we know that a particular exception may be
thrown or to pass a possible exception then we use throws
keyword. Point to note here is that the Java compiler very
well knows about the exceptions thrown by some methods so
it insists us to handle them. Method Level
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the difference between dom and sax parser in java?
Does anyone still use java?
what is anonymous class in java?
How a variable is stored in memory?
Explain notifyall() method of object class ?
What are the ways in which a thread can enter the waiting state?
What are the four corner stones of oop?
Difference between static binding and dynamic binding?
What do you understand by Header linked List?
Why is java called the platform independent programming language?
What is java in detail?
Why string is not thread safe?
What is the difference in between cpp and java? Can u explain in detail?
What is the method in java?
What is boolean data type in java?