import java.io.*;
import java.rmi.NotBoundException;
public class ty {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String s = "";
try {
// s = br.readLine();
// System.out.println(s);
while ((s = br.readLine()) != null) {
if (s.equalsIgnoreCase("exit")) {
System.out.print("程序以退出");
break;
}
System.out.println(s.toUpperCase());
// System.out.println();
// s = br.readLine();
}
} catch (IOException e) {
System.out.println("输入错误");
} finally {
br.close();
isr.close();
}
}
}
问题是当运行后,我第一次输入字符,然后删掉,然后再输入一些字符,然后敲回车,第一次输入的东西留下一个字母!大家看看这是什么问题,谢谢了!
import java.rmi.NotBoundException;
public class ty {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String s = "";
try {
// s = br.readLine();
// System.out.println(s);
while ((s = br.readLine()) != null) {
if (s.equalsIgnoreCase("exit")) {
System.out.print("程序以退出");
break;
}
System.out.println(s.toUpperCase());
// System.out.println();
// s = br.readLine();
}
} catch (IOException e) {
System.out.println("输入错误");
} finally {
br.close();
isr.close();
}
}
}
问题是当运行后,我第一次输入字符,然后删掉,然后再输入一些字符,然后敲回车,第一次输入的东西留下一个字母!大家看看这是什么问题,谢谢了!