Compile time error

@deepgarg46 Don’t use two separate scanner not even in different function. Take input like this :

import java.util.*;
import java.util.Scanner;
public class Main {
   public static void main(String[] args) {
   	
   	
   	Scanner s = new Scanner(System.in);
   	int rows = s.nextInt();
   	int colss= s.nextInt();
   	int[][] arr=new int[rows][colss];
   	for(int row = 0;row<rows;row++ ) {
   		

   		for(int col=0;col<colss;col++) {
   			arr[row][col]=s.nextInt();
   		}
   	}
   	int item=s.nextInt();
   	System.out.println(Finder(arr, item));
   	
   	
   }

   public static int Finder(int[][] arr,int item) {
   	int y=1;
   	
   
   	
   	
   	for(int row=0;row<arr.length;row++) {
   		for(int col=0;col<arr[row].length;col++) {
   			if(arr[row][col]==item) {

   				return 1;
   			}
   			
   		}
   	}return 0;
   	
   }

}
1 Like