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 catch or declare rule for method declarations?

Answer Posted / amit2009mca

the catch and decalre rule to handle the exception
1)when we don't want to handle the particular exception
we declare it
means to say that imagine that you go to market class
and call the purchase method to purchase a book.
but the shopkeeper has n't the particular book so its
responsibility to shopkeeper that he inform you about
particular exception so he declare the exception
Booknotfound and throws like this
class Market
{
public void purchase throws booknotfound
{
}
}
so this is called the declare rule

another is
2)catch
imagine you call the purchase method to buy book but there
is some problem like book is tore up or book is in godown
so its peoblenm pf the sopkeeper so its responsibility of
shopkeeper to handle this particular exception
then the Catch rule comes in a ligtht
like theis
class Narket
{
public purchase()
{
try{
}
catch(Booktoreupexception e or BookinstoreException e)
{
}
thanks if you got this because these all are just for
checked exception thanks
AMIT SINGH09(amitsing2008@gmail.com) thanks

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the old name of java?

922


What is supplier in java?

957


What is the Concept of Encapsulation in OOPS

941


Which is better stringbuffer or stringbuilder?

873


What mechanism does java use for memory management?

921


What are the different types of garbage collectors in java?

1055


What are java packages?

977


What is the difference between post and put?

995


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

929


What is the function of compareto in java?

1011


Explain the difference between transient and volatile in java?

957


How to perform linear search in java?

900


Does list maintain insertion order java?

860


what is the final keyword denotes in java?

1023


Why are the methods of the math class static?

1025