import java.io.*;
class Demo
{
public static void main(String[] args) throws IOException
{
InputStream in = System.in;
StringBuilder sb = new StringBuilder();
while (true)
{
int ch = in.read();
if (ch=='\r')
continue;
if(ch=='\n')
{
String s = sb.toString();
if ("over".equals(s))
break;
System.out.println(s.toUpperCase());
sb.delete(0,sb.length());
}
else//没有这个else , if ("over".equals(s)) break;语句为什么没有执行啊
sb.append((char)ch);
}
}
}
|
|