johnpaulada
10/6/2016 - 11:39 AM

If.java

import java.util.Scanner;

public class If {
    public static void main(String[] args) {
        int number = 0; // Initialize an integer variable.
        
        // Create a Scanner object to ask for input from user.
        Scanner scanner = new Scanner(System.in);

        System.out.println("Enter a number: ");
      	
        // Ask user for number.
        number = scanner.nextInt();
        
        System.out.println("You entered: " + number + "!");
      
        // Checks if number is less than 100.
        if (number < 100) {
            System.out.println("It is less than 100.");
        } else if (number == 100) { // Checks if number is 100.
            System.out.println("It is 100.");
        } else { // Checks if number is more than 100.
            System.out.println("It is greater than 100.");
        }
    }
}