Java User Input The Scanner class is used to get user input, and it is found in the java.util package. To use the Scanner class, create an object of the class and use any of the available methods found in the Scanner class documentation. In our example, we will use the nextLine() method, which is used to read Strings: Input Types In the example above, we used the nextLine() method, which is used to read Strings. To read other types, look at the table below: