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

Can private class be extended java?

1088


Explain what access modifiers can be used for variables?

1107


What are the types of java?

1172


I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

1067


What is a lambda expression ? What's its use ?

1157


What are the steps that are followed when two computers connect through tcp?

1038


What is an enumeration?

1121


Can It is possible to synchronize the constructor of a Java Class?

1218


What is Enum in Java?

1418


What do you mean by constructor?

1032


Can java object be locked down for exclusive use by a given thread?

1059


Give example to differentiate between call by value and call by reference.

1109


What is a numeric digit?

1138


What is the difference between JDBC 1.0 and JDBC 2.0?

3226


Is set ordered?

1032