what is difference between throw and throws in exception?
Answer Posted / ritesh
Whenever we want to force an exception then we use throw keyword.Moreover 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.
Whereas when we know that a particular exception may be thrown or to pass a possible exception then we use throws keyword
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can we inherit a class with private constructor?
What is a Transient Object?
What does system.gc() and runtime.gc() methods do?
What is json parser in java?
Why we cannot override static method?
What is empty string literal in java?
Give some features of interface?
What is a arraylist in java?
What is meant by tab pans?
What is compiler and what its output.
What is java lang object?
What is double data type?
Is null a string?
Is array dynamic in java?
What is the applet security manager, and what does it provide?