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
Is a copy constructor?
How to stop a thread in java? Explain about sleep () method in a thread?
Is ruby built on java?
What is the synonym of framework?
how we can create packages in java?
What is the old name of java?
How to access arraylist elements in java?
Difference between serialization and deserialization in java?
What are abstract methods in java?
What is the return type of the main method?
Explain runtime exceptions?
explain local datetime api in java8?
Explain the difference between hashmap and hashtable in java?
What is float in java?
How do you do absolute value in java?