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 its run?

1118


How do you declare a variable?

1140


What is java argument list?

982


Explain notify() method of object class ?

1162


What is the primitive type byte?

1043


What is downcasting?

1208


Why do we need strings in java?

1041


What is a "pure virtual" member function?

1148


What is number data type in java?

1071


What is a double vs float?

1071


Does java support function overloading, pointers, structures, unions or linked lists?

1162


Explain the importance of join() method in thread class?

1137


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

1062


What is the use of keywords in java?

1027


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

1047