Thanks for taking the time to look at this code. Basically instead of printing out the row that the searched surname is on it prints out line[i][2] i++. How Can i fix this. The Array Size is line[6][5]. And When i search the Furthest surname (line[0][5])
it gives me an array out of bounds exception. Thanks you in advance for the help.
public void searchSurname(String[][] line){ boolean found = false; Scanner scan=new Scanner(System.in); String searchKey=scan.nextLine(); int column = 0; for(int i=0; i<6; i++){ if(searchKey.equalsIgnoreCase(line[i][column])){ found = true; column = i; } } if(found==true){ System.out.println("Person is found!"); for(int i=0; i<line.length;i++){ System.out.println(line[i][column]); } }else if(found==false){ System.out.println("Person is not found"); }