1 package shuzu; 2 3 import java.util.Arrays; 4 import java.util.Scanner; 5 6 public class ZuoYe01 { 7 8 public static void main(String[] args) { 9 Scanner meng00=new Scanner(System.in);10 String[]a=new String[5];11 System.out.println("请输入5句话:");12 for (int i = 0; i < a.length; i++) {13 System.out.println("第"+(i+1)+"句话:");14 a[i]=meng00.next();15 }16 Arrays.sort(a);17 for (int i = 0; i < a.length; i++) {18 System.out.println(a[a.length-1-i]);19 }20 }21 22 }