Boolean expressions and boolean variable assignments - Java Language Basics

Java examples for Language Basics:boolean

Description

Boolean expressions and boolean variable assignments

Demo Code

public class Main {

    public static void main(String[] args) {
        boolean a = true;
        boolean b = false;

        boolean expr1 = a || b;
        boolean expr2 = a && b;

        System.out.print("a||b = ");
        System.out.println(expr1);

        System.out.print("a&&b = ");
        System.out.println(expr2);
    }/*from   ww  w. j av a2  s.  c  om*/
}

Result


Related Tutorials