the given output shouldn't run as 2 is not greater than 3 but this code is giving the output.Even in enter code here
the book from where i took the code is saying it will not give output
class Exercise {
public static void main(String[] args) {
int x = 1;
while (x < 10) {
x = x + 1; // 1+1=2
if (x > 3) { // 2 is not greater than 3 then how can this code give the
// following output?
System.out.println("big x");
}
}
}
}
// output
big x
big x
big x
big x
big x
big x`
big x
Aucun commentaire:
Enregistrer un commentaire