集册 Java实例教程 对数组使用for循环

对数组使用for循环

欢马劈雪     最近更新时间:2020-01-02 10:19:05

510
处理数组的一种方法是使用for循环。

public class Main {


  public static void main(String[] args) {// 来自 时代Java - N o w  J a v a . c o m

    int[] numbers = new int[100];

    for (int i = 0; i < 100; i++)

      numbers[i] = (int) (Math.random() * 100) + 1;

  }


}