我有一个 Java 字符串数组:
public static final String[] FIELDS_NAMES = { "Albert", "Berta", "Carl" };
public static final String[] FIELDS_NUMBERS = { "123", "456", "789" };
并想从我已有的常量中创建第三个常量。目前我通过重复一切来做到这一点:
public static final String[] FIELDS_ALL = {
"Albert", "Berta", "Carl", "123", "456", "789"
};
但我真正想要的是:
public static final String[] FIELDS_ALL = {FIELDS_NAMES, FIELDS_NUMBERS};
知道如何在 Java 中做到这一点吗?显然我不想运行任何循环来改变周围的东西......