-1
String[] names = { "Capacitance", "Current", "Capacitive Reactance",
            "Energy", "Frequency", "Inductance", "Inductive Reactance",
            "Power", "PowerFactor Angle", "RealPower", "ReactivePower",
            "Resistance", "SysytemFrequency", "Voltage" };

如何排序这个数组。任何人请帮助我。

4

1 回答 1

5

试试下面的代码。

对数组进行升序排序

Arrays.sort(names);

对数组进行降序排序

Arrays.sort(names, Collections.reverseOrder());
于 2012-12-28T07:18:45.680 回答