0

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] + " ");
                }
                System.out.println();

                }



}}
3
Contributors
4
Replies
8
Views
1 Year
Discussion Span
Last Post by Mar. Na.
0

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 ...?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.