Reading Text from Standard Input
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = "";
while (str != null) {
System.out.print("> prompt ");
str = in.readLine();
process(str);
}
} catch (IOException e) {
}
applet program
this could be improved with
while ((str = bin.readLine()) != null) {
process(str);
}
since there will be no call of process() with null value.
I would like to know the need for the try/catch. Is there a way to crash a program using standard input?
maganda sya
good