import java.util.Scanner; public class UserInputWithScannerAndLoops { public static void main(String[] args) { // When getting two DIFFERENT types of input (e.g., integers and // strings), use two SEPARATE instances of the 'Scanner' class Scanner input1 = new Scanner(System.in); Scanner input2 = new Scanner(System.in); int number; String phrase; do { System.out.print("Enter an integer (ZERO to quit): "); // Use the 'nextInt' method for integer input number = input1.nextInt(); } while (number != 0); System.out.println(); do { System.out.print("Enter a word/phrase (ENTER to quit): "); // Use the 'nextLine' method for string input phrase = input2.nextLine(); // Use the 'equals' method rather than just "==" to see if // a particular string has been entered } while (!phrase.equals("")); input1.close(); input2.close(); } }