Waveprint - same error is coming again

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int M = sc.nextInt();
int N = sc.nextInt();
//array declaration
int [][] arr = new int[M][N];
for(int i=0; i<M; i++)
{
for(int j=0;j<N;j++)
{
System.out.print(arr[i][j]+ " ");
}
System.out.println();
}

}
public static void Waveprint(int [][] arr)
{
	for(int i=0;i<=arr.length-1;i++)
	{
		if(i%2==0)
		{
			for(int j=0;j<=arr[i].length-1;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");
}

}

@Naman_Gupta,

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int M = sc.nextInt();
		int N = sc.nextInt();
		
		// array declaration
		int[][] arr = new int[M][N];
		for (int i = 0; i < M; i++) {
//			arr[i] = new int[N];
			for (int j = 0; j < N; j++) {
				arr[i][j] = sc.nextInt();
			}
		}
		
		Waveprint(arr);

	}

Take input of the array elements and call the waveprint function.
You can refer to the code snippet above.

yes i have taking input of the array elements and call the waveprint function but still it is coming

@Naman_Gupta,
In the code that you shared above, you are not doing that. Also, I cannot see any new submissions that you have made.

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.