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
Explain the difference between abstract class and interface in java?
Can each java object keep track of all the threads that want to exclusively access it?
What is hashmap in java?
Which graphs are functions?
Is stringwriter thread safe?
What is method overloading with type promotion?
What is the difference between an array and an array list?
How can you set an applet’s height and width as a percentage?
What's the difference between int and integer in java?
Why are there no global variables in java?
What are the types of sockets in java?
What is the difference between class forname and new?
What is the covariant return type?
Which collection allows duplicate values in java?
What is the exact difference in between unicast and multicast object? Where we will use?