CommencerCommencer gratuitement

Equal or not

Checking whether values are equal or not is a useful skill to have. Do you think the following are equal or not? Sometimes things are not as they seem in Java!

Cet exercice fait partie du cours

Introduction to Java

Afficher le cours

Instructions

  • Save the result of checking whether 193 is equal to the value of a to the variable first.
  • Complete the print statement to display the variable first.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

class EqualOrNot {
    public static void main(String[] args) {
    	
        int a = 193;
        
        // 193 is equal to a
        boolean first = ____ ____ ____;
        
        // Complete the print statement
        System.out.println("193 is equal to a: " + ____);
    }
}
Modifier et exécuter le code