?? newarraydemo2.java
字號(hào):
import java.lang.reflect.Array;
public class NewArrayDemo2 {
public static void main(String[] args) {
Class c = String.class;
// 打算建立一個(gè)3*4數(shù)組
int[] dim = new int[]{3, 4};
Object objArr = Array.newInstance(c, dim);
for(int i = 0; i < 3; i++) {
Object row = Array.get(objArr, i);
for(int j = 0; j < 4; j++) {
Array.set(row, j, "" + (i+1)*(j+1));
}
}
for(int i = 0; i < 3; i++) {
Object row = Array.get(objArr, i);
for(int j = 0; j < 4; j++) {
System.out.print(Array.get(row, j) + " ");
}
System.out.println();
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -