arrays.java

来自「Java编程思想 第四课 全代码」· Java 代码 · 共 21 行

JAVA
21
字号
//: c04:Arrays.java
// From 'Thinking in Java, 2nd ed.' by Bruce Eckel
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
// Arrays of primitives.
import java.util.*;

public class Arrays {
  public static void main(String[] args) {
    int[] a1 = { 1, 2, 3, 4, 5 };
    int[] a2;
    a2 = a1;
    for(int i = 0; i < a2.length; i++)
       a2[i]++;
    for(int i = 0; i < a1.length; i++)
       System.out.println(a1.length);
       //System.out.println(
       // "a1[" + i + "] = " + a1[i]);
   // System.out.println(a2[i-1]);
  }
} ///:~

⌨️ 快捷键说明

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