提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
合并两个字符串数组
//N o w J a v a . c o m - 时 代 Java 提供 //package com.book2s; public class Main { public static void main(String[] argv) { String[] pa = new String[] { "1", "abc", "level", null, "book2s.com", "asdf 123" }; String[] pb = new String[] { "1", "abc", "level", null, "book2s.com", "asdf 123" }; System.out.println(java.util.Arrays.toString(mergeTwoStringArrays( pa, pb))); } public static String[] mergeTwoStringArrays(String[] pa, String[] pb) { if (pa == null) return pb; if (pb == null) return pa; /*from N o w J a v a . c o m - 时代Java*/ String[] arr = new String[pa.length + pb.length]; for (int x =