Java中使用split、sort函数

public static void main(String[] args) { 
    // TODO Auto-generated method stub 
    String str = null ; 
    Scanner scan = new Scanner(System.in); 
    str=scan.nextLine(); 
    System.out.println(str); 
    String[] arr = str.split(" "); 
    Arrays.sort(arr); 
    for(int i=0;i<arr.length;i++) 
        System.out.print(arr[i]+"   "); 
} 

 

本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/813941

posted @ 2014-08-10 10:05  商商-77  阅读(154)  评论(0编辑  收藏  举报