Since JDK 1.5 a popular way to read input from standard input (stdin) is using the Scanner class.
Scanner takes input from System.in which uses the InputStream class.
public class ReadConsoleInput {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter string:");
String next = scanner.next();
System.out.println("Enter int:");
int nextInt = scanner.nextInt();
scanner.close();
System.out.println("String is: " + next);
System.out.println("Int is: " + nextInt);
}
}