How to get the user input in Java?
You can use any of the following options based on the requirements. Scanner class BufferedReader and InputStreamReader classes DataInputStream class The readLine method from the DataInputStream class has been deprecated. To get String value, you should use the previous solution with BufferedReader Console class Apparently, this method does not work well in some IDEs.