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 initial size of arraylist in java?

1051


Can we increase size of array?

1023


How do you break a loop?

977


What is object in java?

983


What are the 3 types of loops in java?

1076


Can a constructor be private and how are this() and super() method used with constructor?

996


How do you trim a space in java?

979


What does string mean in java?

1102


Can we use this () and super () in a method?

976


What are the different tags provided in jstl?

954


What is an abstract method in java programming?

1040


Can you explain the final method modifier?

1010


what are synchronized methods and synchronized statements? : Java thread

995


What do you mean by Function Overloading in java?

1177


What does || || mean in math?

936