Hello,
I have create the program for exception handling using nested try in java
Here is my program :
There is error occurred in this program...
Error :
What will be the correction in my program for solve the error????
I have create the program for exception handling using nested try in java
Here is my program :
Code:
class nestedtry
{
public static void main(String args[])
{
try
{
int a,b;
a=5;
b=0;
try
{
int a[];
a=new int[3];
for(int i=0;i<=4;i++)
{
a[i]=10;
}
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.print("Array " + e);
}
}
catch(ArithmeticException e)
{
System.out.print(e);
}
System.out.print("From main");
}
}
Error :
Code:
23.java:12: a is already defined in main(java.lang.String[])
int a[];
^
1 error
Comment