We can use Scanner class
Then we go this way for integers.
Scanner keyboard = new Scanner(System.in); System.out.println("enter an integer"); int myint = keyboard.nextInt();
If we rather a string line:
String text= scan.nextLine();
Note: If you are using nextInt() with nextLine() it may probably could have some trouble cause nextInt() does not read the last newline character of input and so nextLine().