New course! Every coder should learn Generative AI!
Try a free lesson0
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]); } } }
1 Answer
+ 2
thanks, you are right