Calculate Size of Matrix or Size of 2D Array
public class Size_Matrix {
public static void main(String[] args)
{
int[][] matrix = new int[20][30];
System.out.println("Number of rows = " + matrix.length);
System.out.println("Number of columns = " + matrix[0].length);
}
}
public class Size_Matrix {
public static void main(String[] args)
{
int[][] matrix = new int[20][30];
System.out.println("Number of rows = " + matrix.length);
System.out.println("Number of columns = " + matrix[0].length);
}
}
No comments:
Post a Comment