Step1
import java.io.Console;
Step2
public static void main (String args[]) throws IOException {
Console con = System.console();
if (con == null) {
System.err.println("console not found");
System.exit(1);
}
String dta = con.readLine("Enter something-- ");
.............
}
------------------------------
[other way]
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String dta = null;
//Now use this in TRY section
dta = br.readLine(); // input from termminal
No comments:
Post a Comment