import java.util.Scanner; /** A simple Java program to demonstrate reading numbers from standard input. * @author J. Dalbey * @version 1.0 */ public final class NumberDemo { /** * The entry point for this application * @param args (ignored) */ public static void main(String[] args) { // Create a scanner to read from the standard input Scanner console = new Scanner(System.in); // Prompt the user for a number System.out.println("Enter a whole number."); // Obtain the number from the user int n = console.nextInt(); if (n > 0) { System.out.println("Your number is positive."); } // Determine if its even or odd if (n % 2 == 0) { System.out.println("Your number is even."); } else { System.out.println("Your number is odd."); } } }