Run time error(compile time working )

@deepgarg46 in the main print function line no. 18 and 24 you have used arr.length but instead since here you re dealing with column size you have to use arr[0].length which will give you no. of columns. corrected wave print function is :

public static void WavePrint(int[][] arr) {
		for (int i = 0; i < arr.length; i++) {
			if (i % 2 == 0) {
//first change made here.
				for (int j = 0; j < arr[0].length; j++) {
					System.out.print(arr[i][j] + ", ");

				}

			} else {
//second change made here
				for (int j = arr[0].length - 1; j >= 0; j--) {
					System.out.print(arr[i][j]+", ");
				}
			}
		}System.out.print("END");
	}

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.