import java.util.Arrays; public class A03 { public static void main(String[] args) { // TODO Auto-generated method stub char Letter [] = new char []{‘a‘,‘c‘,‘u‘,‘b‘,‘e‘,‘p‘,‘f‘,‘z‘}; System.out.print("原字符 列表:"); for (int i = 0; i < Letter.length; i++) { System.out.print(Letter[i]+" "); } Arrays.sort(Letter); System.out.print("\n升序排序后:"); for (int i = 0; i < Letter.length; i++) { System.out.print(Letter[i]+" "); } System.out.print("\n逆序输出为:"); for (int i = Letter.length-1; i >=0; i--) { System.out.print(Letter[i]+" "); } } }
java-第七章-数组-字符逆序输出,布布扣,bubuko.com
原文地址:http://wenwen520.blog.51cto.com/8956560/1420972