import java.util.Scanner; /******************* * An example of using Scanner to get user input. *********************/ public class FirstDayDemo { /******** * Get a number interactively and tell the user about it. *********/ public static void main(String[] args) { System.out.print("Enter a number: "); // Initialize scanner from System.in (keyboard). Scanner kbd = new Scanner(System.in); // Read the user's input as an int. int num = kbd.nextInt(); // Now the user's input is stored in the variable num; // let's tell them about it. System.out.println("The number you entered was: " + num); // Check whether it is even or odd. if(num % 2 == 0) { System.out.println("Your number is even."); } else { System.out.println("Your number is odd."); } // Print "hello" for as many times as the user entered. for(int i = 0; i < num; i++) { System.out.println("Hello!"); } } }