二维数组
000111
111000
000111

解决方案 »

  1.   

    public static void main(String[] args) {
    int[][] a = { { 0, 0, 0, 1, 1, 1 }, { 1, 1, 1, 0, 0, 0 },
    { 0, 0, 0, 1, 1, 1 } };
    for (int i = 0; i < a.length; i++) {
    for (int j = 0; j < a[i].length; j++) {
    if (a[i][j] == 0) {
    System.out.print(".");
    }else{
    System.out.print(" ");
    }
    }
    System.out.println();
    }
    }
    结果是:
    ...   
       ...
    ...   
      

  2.   


    我说的明用java画图,画成点阵。0代表无,1代表有黑点。