what is difference between throw and throws in exception?
Answer Posted / gourav shivhare
The throw keyword denotes a statement that causes an exception to be initiated. It takes the Exception object to be thrown as an argument. The exception will be caught by an enclosing try-catch block or propagated further up the calling hierarchy. The throws keyword is a modifier of a method that denotes that an exception may be thrown by the method. An exception can be rethrown.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is preflight request?
What is a default constraint?
What is pojo class in java?
How can we make string upper case or lower case?
Write a program to print the pattern given below
How is string immutable in java?
What is oop principle in java?
What is the difference between the direct buffer and non-direct buffer in java?
How arrays are stored in memory in java?
What is meant by collection in java?
Is int a class in java?
What is double in java?
What is the default value of an object reference declared as an instance variable?
What is the difference between throw and throws in java?
What are the various access specifiers for java classes?