Computer Applications
Identify all the errors in the following repetitive statements.
while (z < 1 && z > 100)
{
a = b;
}
Java Iterative Stmts
2 Likes
Answer
The test expression z < 1 && z > 100
will never be true
as the conditions z < 1
and z > 100
cannot be true
at the same time. Thus, the &&
operator will always result in false
.
Answered By
2 Likes
Related Questions
What is an empty statement? Explain its usefulness.
Identify all the errors in the following repetitive statements.
for (int i = 5; i > 0; i++) { System.out.println("Java"); }
Identify all the errors in the following repetitive statements.
while (x == y) { xx = yy; x = y; }
How are these statements different from each other:
(i) break
(ii) continue
(iii) System.exit(0)