Why my code is not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why my code is not working

public class One { public static void main(String[] args) { int[] list = {1, 2, 3, 5, 4}; for (int i = 0, j = list.length - 1; i < list.length; i++, j--) { // Swap list[i] with list[j] int temp = list[i]; list[i] = list[j]; list[j] = temp; } for (int i = 0; i < list.length; i++ ) { System.out.print(list[i]); } } }

4th Dec 2019, 6:53 PM
bdjdndnd hdhdbd
bdjdndnd hdhdbd - avatar
1 Answer
+ 2
thanks, you are right
4th Dec 2019, 7:06 PM
bdjdndnd hdhdbd
bdjdndnd hdhdbd - avatar