提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
计算要放入数组元素中的值。
public class Main { public static void main(String[] args)//nowjava 提供 { final int ARRAY_LENGTH = 10; // constant int[] array = new int[ARRAY_LENGTH]; // create array // calculate value for each array element for (int counter = 0; counter < array.length; counter++) array[counter] = 2 + 2 * counter; System.out.printf("%s%8s%n", "Index", "Value"); // column headings // output each array element's value for