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 exception by user whenever he
feels to throw exceptions. throw is used to throw
either user defined or runtime exception.
for ex : throw new MyException(), here MyException
is user written exception.
throw new NullPointerException(), here
NullPointerException is RuntimeException.

throws: throws is used by the method to throw exception to
the calling method. And method itself does not able
to handle it so it throws to calling method.

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is string is a keyword in java?

978


How can you handle java exceptions?

1033


What is the common usage of serialization? What exceptions occur during serialization?

1129


What is time complexity algorithm?

1055


Is it possible for yielded thread to get chance for its execution again ?

1031


What are multiple inheritances? Is it supported by java?

952


How do you check if an arraylist is not empty?

1122


What are the advantages of autoboxing?

1020


How many bits is a 64 bit byte?

1086


What does null mean in java?

1075


How do you clear a list in java?

1132


What are classloaders?

1021


What is space character in java?

1113


What is qms certification?

955


What is the use of join method?

1033