提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用Arrays.copyOf方法复制数组
//package com.nowjava;/*n o w j a v a . c o m*/ import java.util.Arrays; public class Main { public static void main(String[] argv) throws Exception { String[] arr = new String[] { "1", "abc", "level", null, "nowjava.com", "asdf 123" }; System.out.println(java.util.Arrays.toString(copyArray(arr))); } public static String[] copyAr