what is difference between throw and throws in exception?
Answer Posted / balu
throws clause is used when the programmer does not want to handle the exception and throw it out of a method.
throw clause is used when the programmer wants to throw an exception explicitly and wants to handle it using catch block hence throw and throws are contradictory.
throw clause can be used to throw our own exceptions also i.e user-defined exceptions.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do you sort in java?
What is method overloading and method overriding?
What does index mean in java?
Why do we need singleton class?
What is the file type?
Is there a jre for java 11?
What does singleton class mean?
What is data movement?
What is java util?
Why java is used everywhere?
What are mutable classes?
Can you declare a private method as static?
Which list is sorted in java?
What is output buffer?
What is concurrent hashmap and its features?