import java.util.Scanner;

class Sep5 {
	public static void main(String[] args) {

		Scanner kb = new Scanner(System.in);

		System.out.println("Please enter two integers");

		int num1 = kb.nextInt();
		int num2 = kb.nextInt();

        	/*
		 *
		 * A Boolean expression is an expression that evaluates to either true or false
		 * Since it evalutate to either true or false we can use the expression to 
		 * initialize a boolean variable.
		 *
	 	 * == is the equality operator, we use parenthesis here for clarity
	 	 * (num1 == num2) is either true or false, thus is a Boolean expression
		 *
       		 */ 

		boolean areEqual = (num1 == num2);
		System.out.println("they are equal: " + areEqual);

        	/*
		 *
		 * We use Boolean expression in conditional statements
		 *
		 * A conditional statement is used to define a block of code that is executed when
		 * a given condition, defined by a Boolean expression, is true.
		 *
		 * 	if (bool_expr) {
		 *		// execute code in this block if and only if the Boolean expression is true
		 * 	}
		 *
		 */

		if (num1 == num2) {
			System.out.println("num1 is equal to num2");
		}

		/*
		 *
		 * Relational operators for numeric types can be used in Boolean expressions
		 * The relational operators are: ==, !=, <, >, <=, >=
        	 *
		 */

        	if (num1 >= 5) {
            		System.out.println("num1 >= 5");
        	}

		/*
		 *
		 * Conditional statements may have an else-clause, whose body is executed if the
		 * Boolean expression in the if-clause is false.
		 *
		 * 	if (bool_expr) {
		 *		// code executed when bool_expr is true
		 * 	}
		 * 	else {
		 *		// code executed when bool_expr is false
		 * 	}
		 */

		if (num1 >= num2) {
			System.out.println("num1 is greater or equal to num2");
		}
		else {
			System.out.println("num2 is greater than num1");

		}

        	/*
            	 * Conditional statements can have 0 or more else-if-clauses.
        	 */

		if (num1 == 1) {
			System.out.println("num1 is 1");
		}
		else if (num1 == 2) {
			System.out.println("num1 is 2");
		}
		else {
			System.out.println("num1 is not 1 or 2");
		}

		/*
		 * Boolean operators are used to write compound Boolean expressions.
		 * The Boolean operators in Java are: && (logical AND), || (logical OR, ! (logical NOT)
        	 */

		if(num1 >= 0 && num1 <= 100)) {
            		System.out.println("num1 is between 0 and 100");	
		}

		if ((num1 >= 0 && num1 <= 100) || num2 == 0) {
		    	System.out.println("num1 is between 0 and 100 OR num2 is zero");
		}

		/*
		 * We cannot use == to compare strings.  String is a reference types and so variables
		 * of type String hold references to instances of Strings.  To compare them we must use
		 * the String class' equals method.
		 */

		String str1 = "Hello";
		String str2 = "Bye";

		//if (str1 == str2 ) { ... }	// BAD: Can not compare strings with ==

		areEqual = str1.equals(str2);   // Good
	}
}
