现在的位置: 首页 > 综合 > 正文

HDU 2000 java中的char数组和排序函数的运用

2013年08月20日 ⁄ 综合 ⁄ 共 454字 ⁄ 字号 评论关闭
import java.io.BufferedReader;  
import java.util.*;  
import java.io.Console;  
import java.io.IOException;  
import java.io.InputStreamReader;  
import java.util.Scanner;  
import javax.swing.JOptionPane; 
import java.util.*;  

public class Main {
	
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in); 
        while(sc.hasNext())
        {
        	String s = sc.next(); 
        	char []ch = new char[10];
        	ch = s.toCharArray(); // 将字符串复制到char数组中
        	Arrays.sort(ch); // 排序
        	System.out.println(ch[0]+" "+ch[1]+" "+ch[2]);
        }
        sc.close();
	}
}

抱歉!评论已关闭.