Nombre: Reading from the command line with J2SE and windows command interpreter
Descripción:
Reading from the command line with J2SE and windows command interpreter
URL: http://www.mygnet.net/codigos/j2se/varios/reading_from_the_command_line_with_j2se_and_windows_command_interpreter.2726
Código Fuente:
/*
Author: Gerardo Angeles Nava
Objective: Reading from the command line with J2SE and windows command interpreter
Note: To exit the program press [Ctrl]+[c]
*/
import java.io.*;
class ReadCmdLine{
public static void main(String[] args){
//Read
while(true){
try {
System.out.print("nWrite something and then press enter: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
System.out.println("You write: " + s);
}catch(IOException ioe) {
System.out.println("IO error trying to read input");
System.exit(1);
}
}
}//end main
}//end class