Hi all;
how can i find equal string in 2D array in java in this program,,
i mean in this code i have 2D array 2 rows and 4 columns,for example in my code
the equal string is "orange" ,,so how can search for any equal string in 2D array ??

 public static void main(String[] args) {

            String[][] t={{"hellow","happy","life","orange"},{"blue","orange","door","apple"}};

            for (int i = 0; i < t.length; i++) {
                for (int j = 0; j < t[i].length; j++) {

                    System.out.print(t[i][j] + " ");



Inside your nested loops just use the equals method to compare t[i][j] with the target string.

Thanks , I use it but I mean if can I compare the positions that contain target string for example in my code the string orange is in the position (0,3) and (1,1) how can I compare to get the equal string in 2d array ...?

... by following James' suggestion:
if ( t[0][3].equals(t[1][1])

Ok...thank you very much ...