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
Explain reverse a linked list recursive java solution?
What is the purpose of lambda expressions?
What is the use of flag?
Is string pool garbage collected?
What happens when heap memory is full?
What are the types of literals?
What is return code?
How do you identify independent and dependent variables?
What is the advantage of OOP in java?
How many types of constructors are used in java?
Can we force the garbage collection to run?
Is arraylist zero based?
Give me some null interfaces in java?
What are the steps that are followed when two computers connect through tcp?
Can we call thread start () twice?