Grand temple problem 2

How to sort an two d array?------------

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt(), arr[][] = new int[n][2];
for(int i =0;i<arr.length;i++){
for(int j =0;j<arr[i].length;i++){
arr[i][j] = cin.nextInt();
}
}
int j =0;
for(int i = 0;i<arr.length;i++){
for(int k = 0;k<arr.length-j;k++){
if(arr[k][j]>arr[i][j]){
int temp = arr[i][k];
arr[k][i] = arr[k+1][i];
arr[k+1][i] = temp;
}
}
}
}
}

can you pls elaborate what array you are making because this logic does not seem correct

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.