I'm a beginner at using ArrayList and I want to add a number to a value stored in an element. Basically I want to do arlist(0) += number. here is my code (I've only pasted the relevant parts).
ArrayList<Integer> snakex = new ArrayList<Integer>();
snakex.add(630);
I'm not sure how to go on from here. I've tried:
snakex.get(0) += 5;
Doing this I get the error "The left-hand side of an assignment must be a variable".
How would I be able to change the value of snakex(0) from 630 to 635?.
Thank you !