ASCII码排序 java

2024-11-29 04:43:37
推荐回答(1个)
回答1:

package csdn.forum.test;

import java.util.Arrays;
import java.util.Scanner;

public class JTest {
public static void main(String[] args) {
String []str=new String[3];
char[] ch=new char[3];

for (int i = 0; i < 3; i++) {
str [i]= new Scanner(System.in).next();
for(int j=0;j ch=str[i].toCharArray();
Arrays.sort(ch);
}
for(int l=0;l<3;l++){
System.out.print(ch[l]+" ");
}
System.out.println();
}
}
}