Taking input values for console application can come out as a need at times. To take such inputs the following code snippet can be used.
try {
System.out.print("Enter input value: ");
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
String in = bufferRead.readLine();
System.out.println("The entered value is "+in);
} catch (IOException ex) {
Logger.getLogger(LogManager.class.getName()).log(Level.SEVERE, null, ex);
}
No comments:
Post a Comment