Saturday, 3 September 2011

Array Table in java


class abc
{
public static void main(String args[])
{
int farray[][]={{10,23,22,12,45,5},{13,4,64,3,25,6,9,0,9,4}};
int sarray[][]={{18,26,50,86,13,78,56,1},{93,75,90,71}};

System.out.println("1st array is:");
displayarray(farray);

System.out.println("2st array is:");
displayarray(sarray);
}
public static void displayarray(int arr[][])
{
for(int row=0;row<arr.length;row++)
{
for(int col=0;col<arr[row].length;col++)
{
System.out.print(arr[row][col]+" ");
}
System.out.println();
}
}
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.