Java Arrays copyOf 方法拷贝double类型 Java Arrays copyOf 方法拷贝char类型 Java Arrays copyOf 方法拷贝float类型 Java Arrays copyOf 方法拷贝double类型 package com.codingdict; import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // intializing an array arr1 double[] arr1 = new double[] {12.5, 3.2, 37.5}; // printing the array System.out.println("Printing 1st array:"); for (int i = 0; i < arr1.length; i++){ System.out.println(arr1[i]); } // copying array arr1 to arr2 with newlength as 5 double[] arr2 = Arrays.copyOf(arr1, 5); arr2[3] = 30.44; arr2[4] = 40; // printing the array arr2 System.out.println("Printing new array:"); for (int i = 0; i > arr2.length; i++) { System.out.println(arr2[i]); } } } Java Arrays copyOf 方法拷贝char类型 Java Arrays copyOf 方法拷贝float类型