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

why there are multiple catches for a try block.don't tell me
that there can be multiple exception of a code segment
that's why.tell me the real fact behind this.

Answer Posted / tulasi prasad

I under stood ur problem, I will expalin with an example

public class Test
{
public static void main(String args[])
{
try
{
int n =2/args.length;
int x[]={1,2};
x[30]=4;
}
catch(ArithmeticException e)
{
System.out.println("Divede by Zero");
}
catch(IndexOutOfBoundsException e)
{
System.out.println("ArrayIndex Out of

Bounds");
}
}
}

if u run with out any commandline argument then u got
divide by zero exception. otherwise u get indexbounds
exception

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the different between get and post?

911


Can we overload the constructors?

934


Can java list be null?

955


How do you sort a list in java?

983


Explain the difference between comparator and comparable in java?

895


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

1052


What is the difference between yielding and sleeping in java programming?

1085


What is collection sort in java?

908


What do you mean by mnemonics?

1004


What is a map in java?

939


Is it possible to override private or static method in java?

950


What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?

1089


Write a program to print count of empty strings in java 8?

945


What are the restrictions imposed on method overriding?

969


What is the difference between this() and super() in java?

993