As the title states. In Java I'm wondering if i = 5 and I do list.get(i++) will it return me the item at index 5 and then increment i to 6, or will it give me the item at index 6?
Asked
Active
Viewed 399 times
2 Answers
3
Post-increment. So the first one. Item at 5, then i
becomes 6
on the next line. A simple demonstration,
int i = 0;
System.out.println(i++);
System.out.println(i);
prints
0
1

Elliott Frisch
- 198,278
- 20
- 158
- 249