import java.io.*;
import java.util.*;
public class Keyadd2{
public static void main(String args[]) throws Exception {
Set <Integer> numbers = new TreeSet <Integer> ();
BufferedReader re = new BufferedReader(new InputStreamReader(System.in));
//System.out.println(re.readLine());
String s = " ";
while (!(s=re.readLine()).equals( "end ")){
int num = new Integer(s);
numbers.add(num);
}
System.out.println(numbers.size());
System.out.println(numbers);
for(int num:numbers )
System.out.println(num);
}
}
输入一组数据,排序显示出,end结束输入.
帮忙改正改进.
------解决方案--------------------
程序我运行了,可以的,升序输出的,