Menu
×
×
Correct!

Exercise:

Print "1" if x is equal to y, print "2" if x is greater than y, otherwise print "3".

int x = 50; int y = 50; if (x == y) { System.out.println("1"); } else if (x > y) { System.out.println("2"); } else { System.out.println("3"); }

Not Correct

Click here to try again.

Correct!

Next ❯
int x = 50;
int y = 50;
 (x  y) {
  System.out.println("1");
}  (x > y) {
  System.out.println("2");
}  {
  System.out.println("3");
}  

  
  
  




Go to w3schools.com
Reset Score
Close This Menu

Completed 0 of 59 Exercises:

Java Syntax
Java Variables
Java Data Types
Java Operators
Java Strings
Java Math
Java Booleans
Java If...Else
Java Switch
Java Loops
Java Arrays
Java Methods
Java Classes/Objects
Java Exceptions





×

Reset the Score?

This will reset the score of ALL 59 exercises.

Are you sure you want to continue?



×

Congratulations!

You have finished all 59 Java exercises.

Share your score on facebook: