CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ

Control

Control Statements
Boolean expressions

Examples of Boolean expressions

discountPercent == 2.3    // equal to a numeric literal
letter == 'y'             // equal to a char literal
isValid == false          // equal to the false value

subtotal != 0             // not equal to a numeric literal

years > 0                 // greater than a numeric literal
i < months                // less than a variable

subtotal >= 500			// greater than or equal to a numeric literal
quantity <= reorderPoint   // less than or equal to a variable

isValid                   // isValid is equal to true
!isValid                  // isValid is equal to false
Previous | Boolean expressions | Compare primitive data types | Compare strings | Next