Why is the output of this code 1 1 1 1 1 1 ? 1 public class
Fantastic news! We've Found the answer you've been seeking!
Question:
Why is the output of this code 1 1 1 1 1 1 ?
1 public class Test { 2 public static void main(String[] args) { 3 int list[] = {1, 2, 3, 4, 5, 6}; 4 for (int i = 1; i < list.length; i++) 5 list[i] = list[i - 1]; 6 7 for (int i = 0; i < list.length; i++) 8 System.out.print(list[i] + " "); 9 } 10 }
Related Book For
Computer Systems A Programmers Perspective
ISBN: 9781292101767
3rd Global Edition
Authors: Randal E. Bryant, David R. O'Hallaron
Posted Date: