java.util.Scanner class provides a way to get input from user:
Scanner scanner = new Scanner(System.in);
If input is String:
String string= scanner.nextLine();//to read input as a whole line
String string= scanner.next(); // to read single word
To read integers:
int i= scanner.nextInt();
Here is an article helpful on Scanner.