Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is difference between throw and throws in exception?

Answer Posted / raju

throw : throw is used to throw user defined exceptions.
For ex: MyException written by user.it may be either
checked or unchecked exception.

throws: throws is used to throw exception those are handled by
JVM directly.
throws is used in method declaration to
intimate user that, it throw the exception that must
be handled by calling method.

Note :use throws when your method does not handle exception.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sorting algorithm in java?

1082


What are checked exceptions?

1037


What are data types in oop?

1037


Is null or empty java?

991


What is split return?

1007


Explain java heap space and garbage collection?

1079


Are registers volatile?

939


Why call by value prevents parameter value change?

1077


Differentiate between postfix and prefix operators in java.

1128


Can we able to pass objects as an arguments in java?

1026


Why does java not support pointers?

1110


How to change the priority of thread or how to set priority of thread?

1031


When can you say a graph to be a tree?

1085


what is method reference in java 8?

1040


Do we have pointers in java?

994