I tried the following code :
class
Test {
void display()
{
System.out.println("Displaying");
}
}
class OneMoreTest extends Test
{
void display() throws ArrayIndexOutOfBoundsException
{
char a[] = {'a','n','i','t','a'};
System.out.println(a[5]);
}
public static void main (
String args[])
{
OneMoreTest t = new OneMoreTest();
t.display();
}
}
When i use ArrayIndexOutOfBounds exception..it compiles but when I use IllegalAccessException..it does not? Please guide me.