Martes, Pebrero 7, 2012

basic 33:multidimensional array

package basic;




public class basic2 {




    public static void main(String[] args) {




        int array1[][] = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}};
        int array2[][] = {{11, 12, 13, 14, 15}, {16, 17, 18,}};
        yahoo(array1);
        yahoo(array2);
    }




    public static void yahoo(int x[][]) {




        for (int row = 0; row < x.length; row++) {
            for (int column = 0; column < x[row].length; column++) {
                System.out.println(x[row][column]);
            }
        }
    }
}

Walang komento:

Mag-post ng isang Komento