看好题目要求是重键盘输入一组数值在排序好输出到屏幕下面代码我写的可以使用但并不完善,没对特殊字符考虑- public static void main(String[] args) throws IOException {
- BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
- BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
- String line=null;
- while((line=br.readLine())!=null){
- char[]array=line.toCharArray();
- Arrays.sort(array);
-
- bw.write(array);
- bw.flush();
-
-
- }
- }
复制代码 |