ComenzarEmpieza gratis

Bigger or smaller

Comparing values comes in handy, so let's make sure you are up to speed!

Este ejercicio forma parte del curso

Introduction to Java

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio completando el código de muestra.

class Comparisons {
    public static void main(String[] args) {
    	
        // 5 is smaller than 7
        boolean first = 5 ____ 7;
        
        // 9 is greater or equal to 2
        boolean second = ____ ____ ____;
        
        System.out.println("5 is smaller than 7: " + first);
        System.out.println("9 is greater or equal to 2: " + second);
    }
}
Editar y ejecutar código