1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Java

Connected

Exercise

Bigger or smaller

Making decisions in code requires comparing values to determine which is larger, smaller, or if they're equal. Java provides comparison operators that evaluate to true or false, forming the foundation of program logic. Let's practice comparing numbers!

Instructions

100 XP
  • Save the result of checking if 5 is smaller than 7 to the boolean variable first.
  • Save the result of checking if 9 is greater than or equal to 2 to the variable second.