I would like to know about other ways of getting input from users using other classes like BufferedReader
,etc rather than using Scanner class. So, was there any other way of getting input from the user? If so, was it efficient than Scanner
class?
if you are using the Java SE6 or higher then you can make use of Console
clas
Console console = System.console();
if (console==null){
System.out.print("console not available ");
}else {
String line = console.readLine("Enter name :");
System.out.print("your name :"+line);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With