
public class MyAr{ public static void main(String argv[]) { int[] i=new int[5]; System.out.println(i[5]); } }

It gives ArrayIndexOutOfBoundsException as you haven't add element to array.
Correct Program is:
public class MyAr{
public static void main(String argv[]) {
int[] i=new int[5];
i[0]=1;
i[1]=2;
i[2]=3;
i[3]=4;
i[4]=5;
System.out.println(i[4]);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.