class IfSample {
public static void main(String args[]) {
int x, y;
x = 10;
y = 20;
if (x < y) System.out.println("x is less than y");
x = x * 2;
if (x == y) System.out.println("x is equal to y");
x = x * 2;
if (x > y) System.out.println("x is greater than y");
if (x == y) System.out.println("x is equal to y");
}
}
Output according to me should be
x is less than y
x is equal to y
x is equal to y
But the actual output is
x is less than y
x is equal to y
x is greater than y
Please explain me how is it possible?
Aucun commentaire:
Enregistrer un commentaire