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
Can we declare main () method as non static?
State the merge-sort principle and its time complexity.
Can a string be null?
Can we instantiate interface in java?
Explain about doubly linked list
How does arrays sort work in java?
What is floating data type?
What is a ternary operator in java? What is an interface?
Why is it called buffering?
What is loop in java?
Can this keyword be used to refer static members?
Can one thread block the other thread?
Can we rethrow the same exception from catch handler?
What is a text string?
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.