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

How many types of flags are there?

963


What about features of local inner class?

1016


What does microservices mean?

905


Which of the classes will have more memory allocated?

919


What is meant by inheritance and what are its advantages?

1049


How are the elements of a gridbaglayout organized in java programming?

945


What is collection class in java?

941


How to make a non daemon thread as daemon?

1023


Is 0 a prime number?

936


Can we declare register variable as global?

902


What is jagged array in java?

1021


How can we create a synchronized collection from given collection?

1048


Why java is considered dynamic?

1117


How concurrent hashmap works?

1130


What is string [] java?

915