Thursday, 11 December 2014

// The "BooleanVariables" class.
// Exercise 3.1 (Question 2).  Page 95.
// (from the Carter book).

// State, with reasons, what the following program will print.

public class BooleanVariables
{
    public static void main (String[] args)
    {
        System.out.println ("Exercise 3.1 (question 2)");
        System.out.println ();
        boolean perhaps, maybe;
        perhaps = 4 < 5;
        maybe = -17 % 4 == 1;
        System.out.println ("perhaps = " + perhaps);
        System.out.println ("maybe = " + maybe);

    } // main method
} // SelectionExercises2 (BooleanVariables) class

No comments:

Post a Comment