Quote:
How does iterating through an arraylist work in java or C++?
There is something very wrong in the question, because 'how arrays works' is array 101, array 102.
the only explanation I can think of is that you have made your easy way of learning by skipping some lessons.
Indeed in first, skipping lessons saved you some learning time.
But later you see that some knowledge is missing, and you start to spend more time to learn that missing knowledge. Worse is that you also waste other people time.
Millions of people have learned programming, so courses are the easy way to learn it.
We can't possibly write an explanation better than what is in courses.
The question says that you are missing an extremely fundamental part of the array concept, only a talk with a teacher or tutor can spot exactly what you don't understand and give remedy.