Sample Java File for Reading in Strings from the Keyboard
import java.io.*; // Import the Input and Output Stream Classes
public class JavaKeyboardRead{
public static void main(String[] args){
try{
BufferedReader infile =
new BufferedReader(new InputStreamReader(System.in));
// Open for reading from the keyboard
String line;
System.out.print("Start entering lines to echo print ");
System.out.println("(use \"STOP\" to stop)...");
line = infile.readLine();
while (! line.equalsIgnoreCase("STOP"))
{
System.out.println(line);
line = infile.readLine();
}
infile.close();
}
catch(IOException e){
System.err.println(e);
return;
}
}
}