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
What are the features in java?
why java does not support unsigned keyword?
Can we convert stringbuffer to string?
Is 64bit faster than 32 bit?
Explain the usage of this with constructors?
How many bytes is a string java?
What are variable arguments or varargs?
What is the common usage of serialization? What exceptions occur during serialization?
What is arraylist class in java?
What is the difference between size and length in java?
What is variable and example?
Is there any difference between nested classes and inner classes?
Explain what do you mean by functional overloading in java?
These static constructors are correct ? class A { statc intA() { } static A(int x,int y) { } static A(int x) { } }
Define reflection.