A simple explanation about what the Index out of bound exception is:
Just think that one train is there its compartments are as D1,D2,D3. One passenger came to enter a train and he have a ticket for D4. Now what will happen is the passenger who wants to enter the compartment that does not exist so obviously the problem will arise.
Same scenario: So whenever we try to access the array list, etc. we can only access a existing indexes in any array.
array are existing. If we try to access the
array, it is not present there actually, so the index out of bound exception will arise.
Hope the above explanation will help you in fixing your all the errors.