difference throws and throw in java
Answers were Sorted based on User's Feedback
Answer / chaitanya
throws clause is used when the programmer does not want to
handle the exception and throw it out of a method.throw
class is used when the programmer wants to throw an
exception explicitly and wants to handle it using catch
block.hence ,throws and throw are contradictory.
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / mary kamal
when exception raises if we nt handeling we just throw,and throws is used to handle the exception nt by programer,it is an indication to catch the exception who wer using that class
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / shanthini
The keyword 'throws' should be used only with the methods while the keyword 'throw'is a clause...
Throws is actually a declaration of any methods and Throw is used to handle the exceptions...
| Is This Answer Correct ? | 3 Yes | 0 No |
How do you use wildcards?
What things should be kept in mind while creating your own exceptions in java?
What is a local block?
how can u handle run time exception in java? explain with brief explanation with examples?
Which sorting is used in arrays sort in java?
What is the indent key?
What is the static variable?
What are class members by default?
Does java have a compiler?
What is meant by design patterns?
What technique can be employed to compare two strings?
What are different access specifiers in java? Explain