multdimarraytypes.java

来自「程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件」· Java 代码 · 共 26 行

JAVA
26
字号
package examples.basic;

/** A class to demonstrate the initialization and
  * use of multidimensional arrays
  */
public class MultDimArrayTypes {
   /** The test method of the class
     * @param args Not used
     */
   public static void main( String[] args ) {
      int[][] b;
      b = new int[3][];
      b[0] = new int[5];
      b[1] = new int[7];
      b[2] = new int[2];
      b[0][4] = 1256;

      int[][] c = new int [2][4];
      c[0][1] = -6754;

      int[][] d = { {-5,-6,8 },{-2,11,3456,5 },{7 } };

      System.out.println( "b[0][4]=" + b[0][4] + 
         " c[0][1]=" + c[0][1] + " d[1][3]=" + d[1][3] );
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?