To take input from user through Console, we have to import Scanner class from Util Library.
import java.util.Scanner;
Once we create an object of Scanner Class, we can easily take user input.
System.out.println("Enter your name: ");
Scanner s = new Scanner(System.in);
String name = s.nextLine();
System.out.println("Your username is " + name);