Using Scanner.nextInt() whilst ignoring rest of line
In order to remove the junk after the integer, you can make use of Scanner.skip(Pattern pattern). It allows you to skip over any set of characters that match a pattern:

scanner.skip(".*");

This method call will cause the Scanner to skip over any characters that match the pattern ".*"  .  The period character in a regular expression matches any single character.  The repetition character * causes matching zero or more of the previous character.  So the pattern .* will match zero or more of any characters.  Thus, it will skip over any characters currently on the stream. So now our code will look like:

    int myFirstInt = scanner.nextInt();
    // Ignore rest of line
    scanner.skip(".*");

    System.out.print("2) Enter an integer (and some junk afterwards): ");
    int mySecondInt = scanner.nextInt();
    scanner.skip(".*");
    System.out.print("3) Enter the third integer: ");
    int myThirdInt = scanner.nextInt();

    System.out.printf("\nFirst: %d, Second: %d, Third: %d\n",
                      myFirstInt, mySecondInt, myThirdInt);


It is a simple way to flush the stream so that it is clear of bad characters, and ready to be reused!