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 difference between throw and throws in exception
handling.

Answer Posted / aravinda reddy

Whenever we want to force an exception then we use throw
keyword,throw keyword can also be used to pass a custom
message to the exception handling module i.e. the message
which we want to be printed. throw we will use at statement
level.

Whereas when we know that a particular exception may be
thrown or to pass a possible exception then we use throws
keyword. Point to note here is that the Java compiler very
well knows about the exceptions thrown by some methods so
it insists us to handle them. Method Level

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a boolean used for?

1115


What does opcode mean?

1088


How we can skip finally block of exception even if some exception occurs in the exception block in java?

951


What is the latest version of java?

1137


Why is a constant variable important?

962


What is a consumer in java?

1020


Can we have try block without catch block?

1031


Explain about member inner classes?

1104


When super keyword is used?

1013


What exceptions occur during serialization?

1090


What is command line argument in java?

1154


Is static a keyword in java?

985


how do I create a runnable with inheritance? : Java thread

985


What is multithreading and its advantages?

1071


What do you mean by light weight and heavy weight components?

1019