i'm currently stuck on an assignment where I have to reverse the order of the elements in my Array. But the problem is that I only get the 10 10 times and not 10 9 8...
package JavaSection4;
public class Assignment4Nr2 {
public static void main(String[] args) {
int[] ranNum = new int[10];
ranNum[0] = 1;
ranNum[1] = 2;
ranNum[2] = 3;
ranNum[3] = 4;
ranNum[4] = 5;
ranNum[5] = 6;
ranNum[6] = 7;
ranNum[7] = 8;
ranNum[8] = 9;
ranNum[9] = 10;
for(int i = 0; i < ranNum.length; i++) {
int l = 0;
l = ranNum.length - 1;
System.out.println(ranNum[l]);
}
}
}