public class TestotherStream {
public static void main(String[] args) {
BufferedReader br=null;
try{
InputStream is=System.in;
InputStreamReader isr=new InputStreamReader(is);
br=new BufferedReader(isr);
System.out.println("请输入字符串:");
String str;
while(true) {
str=br.readLine();
if (str.equalsIgnoreCase("e") || str.equalsIgnoreCase("exit")) {
break;
}
String str1 = str.toUpperCase();
System.out.println(str1);
}
}catch(IOException e){
e.printStackTrace();
}finally {
try {
if(br!=null){
br.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
}
}
请输入字符串:
dsfsf
DSFSF
exit