Here is the code and i'm really confusing about the output.
public static void main(String[] args) {
int a = 1;
int b = 1;
for (int c = 0; c < 5; c++) {
if ((++a > 2) || (++b > 2)) {
a++;
}
}
System.out.println(a + " " + b);
}
The output is 10 2
However, why could a always change but b remains the same?
Aucun commentaire:
Enregistrer un commentaire