Finding for a specific row in a 2D Array and printing it out in Java -


sorry, i'm new java. created 2d array , populated string data. task find specific row in array, filled string , print out. mean print row found. problem don't know row be. managed find row , print it, prints column along found row. possible print row not column? sorry english.

public class math extends studentcharts {  public math(){  math = new string [3][3];  math[0][0]="math";      math[0][1]="person1";    math[0][2]="49";    math[1][0]=math[0][0];  math[1][1]="person2";    math[1][2]="12";    math[2][0]=math[0][0];  math[2][1]="person3";    math[2][2]="31";   }  public void prnt (string namechk){     int x = 0;     int y = 0;      (x=0; x<3; x++) {        if (namechk.equals(math[x][1])) {            (y=0; y<3; y++) {         system.out.println(math[x][y]+" ");     }        }        else { system.out.println("error");     } 

the main class:

public static void main(string[] args) {      math chr1 = new math();      scanner user = new scanner(system.in);     system.out.println("enter full name, please");     string namecheck = user.nextline();      chr1.prnt(namecheck); 


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -