What is the problem in this code snippet i am new to java?

class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
//int[][] array;
int i,j,t,number;
Scanner scn=new Scanner(System.in);
t=scn.nextInt();
while(t!=0){
number=scn.nextInt();
int[][] array=new int[number][10];
for(i=0;i<number;i++){
for(j=0;j<10;j++){
array[i][j]=scn.nextInt();
}
}
for(i=0;i<number;i++){
for(j=0;j<10;j++){
//strings[i][j]=scn.nextInt();
System.out.printf("%d", array[i][j]);
}
System.out.printf("\n");
}
t–;
}
}
}

This code snippet is throwing the nosuchelement error case while compilation.
Screenshot from 2023-02-06 20-02-43

After printing “\n”, you should be doing t-- instead of t-

Here is the rectified code. Hope this solves your problem

import java.util.Scanner;

class Codechef {
    public static void main (String[] args) throws java.lang.Exception {
        Scanner scn = new Scanner(System.in);
        int t = scn.nextInt();
        while(t-- > 0){
            int number = scn.nextInt();
            int array[][] = new int[number][10];
            for(int i = 0;i < number; i++) {
                for(int j = 0; j < 10; j++) {
                    array[i][j] = scn.nextInt();
                }
            }
            for(int i = 0; i < number; i++){
                for(int j = 0; j < 10; j++){
                    //strings[i][j]=scn.nextInt();
                    System.out.print(array[i][j]);
                }
                System.out.println();
            }
        }
    }
}

Hii
change t- to t-- otherwise while loop doesn’t work as “–” is decrement operator.