Which JAVA Class allows us to get input from user? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Which JAVA Class allows us to get input from user?

27th Apr 2019, 5:03 AM
TheEngineerIN
TheEngineerIN - avatar
2 Answers
+ 5
1. Scanner Scanner s = new Scanner(System.in); String name = s.nextLine(); 2. Console String name = System.console().readline(); 3. Buffered Reader Similar concept with scanner: just declare it and call when getting input. I personally would prefer Scanner
27th Apr 2019, 7:27 AM
Mufungo Geeks
Mufungo Geeks - avatar
+ 3
Scanner
27th Apr 2019, 7:26 AM
Sonic
Sonic - avatar