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

What is the difference between member variables initialization and assignment in a constructor?

1176


Explain inheritance in java?

930


What is the meaning of I ++ in java?

1103


What is flush () in java?

958


What is thread count in java?

953


what is enumset?

1045


What java is used for?

1027


Will the jvm load the package twice at runtime?

1046


What is the difference between processes and threads?

995


What is encapsulation in java?

1049


What is a static class in java?

962


How hashset works internally in java?

1016


Explain creating threads by implementing runnable class?

1088


define the terminology association.

1049


What is the difference between an interface and an abstract class?

951