public class arrary_ {
public static void main(String[] args) {
System.out.println("Start");
//
System.out.println("------------------------");
int x[][] = new int[2][3];
System.out.println("x.length -> " + x.length);
System.out.println("x[0].length -> " + x[0].length);
System.out.println("x[1].length -> " + x[1].length);
//
System.out.println("------------------------");
int y[][] = {
{1, 2, 3, 4},
{10, 20, 30, 40},
{100, 200, 300, 400}
};
System.out.println("y.length -> " + y.length);
System.out.println("y[0].length -> " + y[0].length);
System.out.println("y[1].length -> " + y[1].length);
System.out.println("y[0][0] -> " + y[0][0]);
System.out.println("y[0][1] -> " + y[0][1]);
System.out.println("y[0][2] -> " + y[0][2]);
System.out.println("y[0][3] -> " + y[0][3]);
System.out.println("y[1][0] -> " + y[1][0]);
System.out.println("y[1][1] -> " + y[1][1]);
System.out.println("y[1][2] -> " + y[1][2]);
System.out.println("y[1][3] -> " + y[1][3]);
System.out.println("y[2][0] -> " + y[2][0]);
System.out.println("y[2][1] -> " + y[2][1]);
System.out.println("y[2][2] -> " + y[2][2]);
System.out.println("y[2][3] -> " + y[2][3]);
System.out.println("End");
}
}
|