What is the difference between throw and throws?

Answer Posted / suresh

mainly throw is used for user defined exceptions and throws
is used for compiler defined excetions.
Ex: if u get a NullPointer exception then we throws this
excetion to the compiler defined excetion class.

if u get malformed or ur own excetion in this time we to
throw this to our own defined excetion

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an object’s lock and which object’s have locks?

497


What is consumer in java?

511


How do you empty a list in java?

525


How listener identify that the event came from a particular object?

1455


Does constructor creates the object ?

570






What is the same as procedures?

523


How does compareto method work?

513


What is method reference?

505


Do we have pointers in java?

520


Is set ordered?

526


What state is a thread in when it is executing?

514


What is json parser in java?

599


What are the features of java?

521


What is a java applet? What is an interface?

614


What are the four integer types supported by java?

548