I am new to Java programming. So i tried to reverse the elements of an array using the code shown in the image. But I am getting a completely different kind of answer. Please help me out! https://i.stack.imgur.com/CQCyJ.jpg
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] arr = {1,3,4,6};
int[] arr2 = new int[4];
for (int k = 0; k<4; k++){
arr2[4-(k+1)] = arr[k];
}
System.out.println(arr2);
in.close();
}
}