sort逆序(char String)

mac2022-06-30  121

import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in =new Scanner (System.in); String[] a=new String[10]; for(int i=0;i<10;i++) a[i]=in.next(); Arrays.sort(a,Collections.reverseOrder()); for(String m:a) { System.out.println(m); } } }

 

转载于:https://www.cnblogs.com/Weixu-Liu/p/9165538.html

最新回复(0)