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
difference between byte stream class and character stream class?
How many JVMs can run on a single machine and what is the Just-In-Time(JIT) compiler?
What are the five major types of reference sources?
What is private static class in java?
How do you replace all in word?
How do you create a first line indent?
Why should I use abstract class?
Can a variable be local and static at the same time?
What is a void method java?
How to make a write-only class in java?
How do constructors use this() and super()?
Why we used vector class?
Java is pass by value or pass by reference? Explain
How is final different from finally and finalize?
What do you understand by a Static Variable?