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 the difference between throw and throws?

Answer Posted / manish kushwaha

First of all i would say both are reserved keyword in java

In Java Exception handling we are using above keyword throw
and throws.

Difference:
throws: throws clause is always use to propagate method
level exception, when ever you will use this clause, caller
method responsibility is to handle exception trowed by the
same method.

throw: this is the clause use to throw the instance of that
exception, main use of this throw clause is in user define
exception use you have written your own exception when ever
this exception will come you will throw this exception object.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is method reference in java 8?

1045


What is a buffer in java?

1038


What is difference between string and new string?

1040


What is native method in java?

1071


How many arguments can a method have java?

1037


Does java map allow duplicates?

905


Can a class be private in java?

1003


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

2187


How does a for loop work java?

1051


What Is Query Throttling in java?

1003


Is java hashset ordered?

1123


Are private methods final?

912


How many tetrahedral voids are there in bcc?

1105


How do you define a parameter?

1045


How do you add an element to a set in java?

1043