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 / arun

throw is used to throw an exception manually when we feel
that particular line of code in our program is going to
throw an exception
throw new MyException("exception")

throws is used instead of try and catch block,if we are not
using try and catch block and we know that our program is
going to throw an exception than we use throws key word

public void myExecption() throws Exception

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When will we prefer to use set and list in java and why?

964


How do you convert bytes to character in java?

1001


Why are the methods of the math class static?

1077


What are JVM.JRE, J2EE, JNI?

1102


Is vector synchronized in java?

1003


What is constructor in java ?

1196


List some features of the abstract class.

1069


What is treeset in java?

1004


What is a java developer salary?

985


How do you check whether the list is empty or not in java?

980


Describe 2 different ways to concatenate two strings.

1204


What is the difference between a switch statement and an if statement?

1092


What are packages in java?

1654


Can we use different return types for methods when overridden?

1001


How many static init can you have?

1216