Java read input from console

To capture input from console in Java program you have several options. Two of the most commons ones are to use Scanner (java.util.Scanner) or BufferedReader (java.io.BufferedReader). Both of them are using System.in (standard input stream) to capture the keyboard input. ⚠ One thing to consider is that both classes Scanner and BufferedReader implement Closeable (java.io.Closeable). … Read more