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

What for read() function?

3 Answers  


Diff between C++ and java?

9 Answers   TCS,


What is static synchronization?

0 Answers  


What Is Resource Leak?

2 Answers  


Describe what happens when an object is created in java ?

0 Answers  






How do you implement tree mirroring in java?

0 Answers   EXL, HCL,


In the HashMap, we know the values but we dont know the key, then how can we get the key from HashMap ?????

4 Answers   Kanbay,


What is a variable analysis?

0 Answers  


What are the main features of java?

0 Answers  


What is string immutability?

0 Answers  


What is meant by 'Class access modifiers'?

0 Answers   HCL,


What are possible key words, we can use to declare a class?

2 Answers   Tech Mahindra,


Categories