[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/windweb/JavaTutorial/master/src/F020_LogicalOperators.java [Back]  [Original]

/* Logical Operators /  
        "||" -  OR
        "&&" -  AND
        "!" -  NOT
*/
public class F020_LogicalOperators {
    public static void main(String[] args) {
        int temperature = 22;
        boolean isWarm = temperature > 20 && temperature < 30;
        System.out.println(isWarm);
        //  temperature  12
        temperature = 12;
        isWarm = temperature > 20 && temperature < 30;
        System.out.println(isWarm);

        boolean hasHighIncome = true;
        boolean hasGoodCredit = true;
        boolean hasCriminalRecord = false;
        boolean isEligible = ((hasHighIncome || hasGoodCredit) && !hasCriminalRecord);
        // "||" -   OR
        // "&&" -  AND
        System.out.println(isEligible);
    }
}

Web Proxy Viewer  |  New URL  |  Original Page