输入的字符不是回车就重新输入:
import java.io.IOException; public class HelloWorld {
public static void main(String[] args) {
try {
while ((char)(System.in.read()) != '\n') {
;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
2023-01-06 14:40:37
输入的字符不是回车就重新输入:
import java.io.IOException; public class HelloWorld {
public static void main(String[] args) {
try {
while ((char)(System.in.read()) != '\n') {
;
}
} catch (IOException e) {
e.printStackTrace();
}
}
}