0

Pre increment

int i=0; int b=0; while(++i<5){ b++; } System.out.println(b); // because this is a repetition block with condition ++i, the result must be 4. Because this while blick is executed 4 times as long as ++i<5

9th Jul 2025, 10:02 PM
Oliver Pasaribu
Oliver Pasaribu - avatar
3 Answers
0
Are you asking a question? If so please clarify. If not please don’t spam this section.
9th Jul 2025, 10:38 PM
Zvi
Zvi - avatar
0
Yes. I am asking. Since I a have answered this question that the value stored in variable b after the while block executed must be 4. Buat It is a wrong answer. Zvi
10th Jul 2025, 4:23 AM
Oliver Pasaribu
Oliver Pasaribu - avatar
0
Not sure why you say it’s wrong. I just tried it and I got 4
10th Jul 2025, 12:22 PM
Zvi
Zvi - avatar