90 degree clockwise-------

what’s run error in my code

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][n];
for(int i = 0;i<n;i++){
for(int j = 0;j<n;j++){
arr[i][j] = cin.nextInt();
}
}
for(int j = n-1;j>-1;j–){
for(int i = 0;i<n;i++){
System.out.print(arr[i][j]+ " ");
}
System.out.println();
}
}
}

Hi @AbhishekAhlawat1102,
You have done j- instead of j-- . Other than that everything is ok.

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.