Consider the Java code for reading a string after integers using Scanner:
Scanner sc = new Scanner(System.in);
int num1 = sc.nextInt();
int num2 = sc.nextInt();
sc.nextLine();
String line = sc.nextLine();
System.out.println("You entered: " + num1 + ", " + num2 + " and '" + line + "'");