boolean flag = true;
while(flag)
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s = in.readLine();
list.add(s);
if("#".equals(s))
flag = false;
}
list.remove("#");
String[] str = list.toArray(new String[]{});
java.util.Arrays.sort(str);
System.out.println("輸入最小字符: " + str[0]);
沒處理異常,沒考慮只輸入 #