Creating and using a two-dimensional array of 6.3 6.3.3 using two-dimensional arrays

6.3.3 using two-dimensional arrays

  1. 3 outputs a write code for row 4 and all matrix elements are zero.
public class Demo {
	public static void main(String[] args) {
		int a[][]=new int[3][4];
		for(int i=0;i<a.length;i++) {
			for(int j=0;j<a[i].length;j++) {
				System.out.print(a[i][j]);
			}
			System.out.println();
		}		
	}
}

 result

Note : After the array is declared as an array elements and complete allocate space for the array elements must be initialized ( initialization is first assigned mean values ) only after the use of array elements. If no initialization of array elements, the array elements also have default values, the default value table array element types shown in FIG.

Published 35 original articles · won praise 5 · Views 847

Guess you like

Origin blog.csdn.net/m0_43443133/article/details/105255425
Recommended