Please check my code

Can you please check my code, the output is right but it didn’t pass any testcase.

@rg361 Just a small mistake after every comma put a space and your answer will come right.
i.e. instead of “,” use ", " at both the places where you have used ,
corrected code :

import java.util.Scanner;

class Main {

	public static void main(String[] args)
    {

        Scanner scn = new Scanner(System.in) ;
        int M = scn.nextInt();
        int N = scn.nextInt();
        int arr[][]=new int[M][N];
                for(int i=0;i<M;i++)
        {
                	for(int j=0;j<N;j++)
                	{
                		arr[i][j] = scn.nextInt();
                	}
        }
                wavePrint(arr);
    }
                
                public static void wavePrint(int arr[][])
                {
                	for (int i = 0; i < arr.length; i++) {

                        if (i % 2 == 0) {
                            for (int j = 0; j < arr[i].length; j++){
                                System.out.print(arr[i][j]+", ");
                            }
                        }else{
                            for (int j=arr[i].length-1;j>=0;j--){
                                System.out.print(arr[i][j]+", ");
                            }
                        }
                    }
                    System.out.print("END");
                }
}

I tried it but still didn’t work

Okay it worked, thanks