This is the code. I tried to solve it, but I can\'t understand how its output is 111111?
public class Test { public static void main(String[] args) {
for (int i = 1; i < list.length; i++) list[i] = list[i - 1];
is equivalent to:
list[1] = list[1-1] = list[0] = 1 list[2] = list[2-1] = list[1] = 1 list[3] = list[3-1] = list[2] = 1 list[4] = list[4-1] = list[3] = 1 list[5] = list[5-1] = list[4] = 1
Got it?