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
What is immutability in java?
What is javac_g?
What is the range of the short type?
What is class level lock ?
Is java type safe?
How can we create a synchronized collection from given collection?
How do you reverse a word in java?
How is it possible in java programming for two string objects with identical values not to be equal under the == operator?
Explain when classnotfoundexception will be raised ?
What is arraylist e in java?
What are internal and external variables?
what are the states associated in the thread? : Java thread
Is linkedlist thread safe in java?
How many threads can I run java?
Is sizeof a keyword in java programming?