Java示例阵列填充的示例示例 Java示例数组填充 Java示例扩展数组 Java示例阵列填充的示例示例 import java.util.Arrays; public class HelloWorld { public static void main(String[] args) { // initializing int array int arr[] = new int[] {1, 6, 3, 2, 9}; // let us print the values System.out.println("Actual values: "); for (int value : arr) { System.out.println("Value = " + value); } // using fill for placing 18 Arrays.fill(arr, 18); // let us print the values System.out.println("New values after using fill() method: "); for (int value : arr) { System.out.println("Value = " + value); } } } Java示例数组填充 Java示例扩展数组