If you change the for loop in the program to for(int j = 0; j < 6; j++) you will get a runtime exception.
There are 5 elements in the array, but they have indexes of 0 to 4, there in no element 5..

Please note that it is the programmer's responsibility to make sure that the subscript is never less than 0 or more than the size. Doing so will result in an "Index Out of Range exception".