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...

Catch(Exception e){
}

in that what is Exception and purpose of that in that place
exactly?

Answer Posted / anjani kumar jha

Before understand the concept of Catch u have to understand
the concept of try,that is why try?

Try-------it is used when we know that some piece of code is
going to throw some exception example when u are dividing
somthing/0 means it may throw exception so we use the try
block and put that code inside the try block

Catch:--------Every try there must be catch or finally
block. Catch is used to catch to exception.As for example
the division example may throw airthmatic exception so will
declare this exception in catch like

Catch(AirthmaticException ae)
{
System.out.println("hi cannt divide by zero");
System.out.println(ae);
}

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain different ways of creating a thread?

1006


What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?

1057


What are three advantages of using functions?

976


How do I type unicode?

926


Is 0 an even number?

947


What is externalizable?

1030


What is main function purpose?

987


Can we store variables in local blocks?

1318


When a byte datatype is used?

2104


Name few java.lang classes introduced with java 8 ?

948


Can I extend singleton class in java?

1055


How many types of interfaces are there?

1005


Can we override static methods in java?

1035


What is widening and narrowing in java? Discuss with an example.

1002


What is the base class of all exception classes?

1036