ICSE Class 10 Computer Applications Question 4 of 69

Iterative Constructs in Java — Question 4

Back to all questions
4
Question

Question 3(ii)

Identify all the errors in the following statements.

while (x < 1 && x > 50)
{
    a = b;
}
Answer

The test expression x < 1 && x > 50 will never be true as the conditions x < 1 and x > 50 cannot be true at the same time. Thus, the && operator will always result in false.