Why is the output of this code 111111?

后端 未结 9 1892
星月不相逢
星月不相逢 2021-01-13 20:10

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) {
         


        
9条回答
  •  无人共我
    2021-01-13 20:49

    take a look at my answer here :
    Why am I not getting the output I am supposed to be?

    anyway... the answer is simple...
    in first loop, print your array and you will see what happens to your array
    something like this:

    for (int i = 1; i < list.length; i++){
              list[i] = list[i - 1];
              System.out(list);
    }
    

提交回复
热议问题