/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template */ package inclassoct6th; import java.util.Scanner; /** * * @author caleb */ public class InClassOct6th { /** * @param args the command line arguments */ public static void main(String[] args) { // Create a scanner Scanner input = new Scanner(System.in); //Define args int number1 = 5, number2 = 17; System.out.print("What is " + number1 + " + " + number2 + "? "); int answer = input.nextInt(); while (number1 + number2 != answer) { System.out.println("Wrong answer, try again. What is " + number1 + " + " + number2 + "?"); answer = input.nextInt(); } System.out.println("You got it!"); } }