package 读取键盘录入;
import java.io.*;
public class ReadIn
{
public static void main(String[] args) throws IOException
{
InputStream is = System.in;
StringBuilder sb = new StringBuilder(); //把键盘录入的都存到了数组当中去了吗?,二者之间有必然的联系吗?
while(true)
{
int ch = is.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
sb.append((char)ch);
}
}
}
//BufferedReader bufr = new BufferedReader(new InputStreamReader(System.in)); |