import java.io.*;

// This program demonstrates boolean variables

public class Booleans {

    public static void main (String [] args) {
	boolean b1 = 2 < 3;
	boolean b2 = !b1;
	b1 = b1 && b2;

	System.out.println("b1 = " + b1 + " b2 = " + b2);

	// conditionals with boolean variables:
	if (b1) {
	    System.out.println("Red");
	} else {
	    System.out.println("Blue");
	}
    }
}

This is an example from CSci 1211 course.