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

How can you traverse a linked list in java?

1129


Which list is sorted in java?

1032


What does arrays sort do in java?

1017


What are Normalization Rules? Define Normalization?

1054


How many bytes is a unicode character?

1007


What is the default value of the local variables?

1020


What is the buffer limit?

1029


Why do we use bufferedreader?

1008


What's the difference between comparison done by equals method and == operator?

972


How many return statement are allowed in a function?

934


Which list does not allow duplicates in java?

938


What is dot operator?

1036


Can you run java program without main method?

1063


How do I get 64 bit java?

1113


In the below example, what will be the output?

1029