difference throws and throw in java

Answers were Sorted based on User's Feedback



difference throws and throw in java ..

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

difference throws and throw in java ..

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

difference throws and throw in java ..

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

Post New Answer

More Core Java Interview Questions

can you use the two main method in same class?how?

4 Answers   DELL, Geosoft, SparkTG,


How will you print number in reverse (descending) order in BST.

0 Answers   GrapeCity,


what is server side caching?

0 Answers   AIG,


Is hashset ordered java?

0 Answers  


How do you write a conditional statement?

0 Answers  


How can a class be accessed, If no access modifiers are declared?

4 Answers  


How the metacharacters are different from the ordinary characters?

0 Answers  


Explain the difference between string, stringbuffer and stringbuilder in java?

0 Answers  


Can we initialize the final blank variable?

0 Answers  


What is collection class in java?

0 Answers  


What is the main method java?

0 Answers  


How do you identify if jvm is 32-bit or 64-bit from java program?

0 Answers  


Categories