i got a short question.
ArrayList<T> x = (1,2,3,5)
int index = 6
if (x.get(6) == null) {
return 0;
}
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 6, Size: 4
How can I avoid this? I just want to check if there is something in the array with index 6. If there is (null)/(nothing there) i want to return 0.