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 udp in java?
What is the size of a string in java?
When is finally block not called?
I want to re-reach and use an object once it has been garbage collected. How it's possible?
Why java is considered dynamic?
What does flag mean in java?
Can we access instance variables within static methods ?
What is the difference between actual and formal parameters?
How do you create a reference in java?
What is navigable map in java?
What is api in java?
Explain methods specific to list interface?
Can a serialized object be transferred via network?
Explain about wait() method?
Can we override final method?