Mar 20, 2010

Java Program for intializing and printing a Two-dimensional array

public class Twoarray
{
    public static void main(String args[])
    {
        int a[][]={{5,2},{1,4},{2,3}};
    System.out.println("given Two-dimensional array is: ");
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<2;j++)
            {
                System.out.print(a[i][j]);
            }
        System.out.print(" ");
        }
    }
}

1 comment: