Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: PiMaster314 on May 5, 2020



Title: What is the output of the following code?public class Test { public static void main(String[] args) ...
Post by: PiMaster314 on May 5, 2020
What is the output of the following code?

public class Test {
public static void main(String[] args) {
int list[] = {1, 2, 3, 4, 5, 6};
for (int i = 1; i < list.length; i++)
list[i] = list[i - 1];

for (int i = 0; i < list.length; i++)
System.out.print(list[i] + " ");
}
}


▸ 2 3 4 5 6 1

▸ 1 1 1 1 1 1

▸ 1 2 3 4 5 6

▸ 2 3 4 5 6 6


Title: What is the output of the following code?public class Test { public static void main(String[] args) ...
Post by: austire on May 5, 2020
Content hidden