Here is the code:
Scanner input = new Scanner(System.in); int val = input.nextInt(); String value = input.nextLine(); // Program continues from here