How to read input from console in java?

Reading input from the console can be done using the Scanner class.

Example:


  Scanner scanner = new Scanner(System.in);
  String input = scanner.nextLine();
  System.out.println("You entered: " + input);
  

Beginner's Guide to Java