Consider the following paint method to answer the questions below:
public void paint(Graphics page)
{
int x, y = 200;
page.setColor(Color.blue) ;
for (x = 100; x < 200; x += 20)
page.fillRect(x, y, 10, y-x) ;
}
-Which of the following statements are True about Java loops?
A) all three loop statements are functionally equivalent
B) while loops and do loops are essentially the same; but while loops always execute at least once
C) if you know the number of times that a loop is to be performed, the best loop statement to use is a while loop
D) loops may be replaced by an appropriate combination of if-else and switch statements
E) none of the above
Correct Answer:
Verified
Q6: The do loop differs from the while
Q7: If a switch statement is written that
Q7: A switch statement must have a default
Q8: The following nested loop structure will execute
Q9: Consider the following paint method to answer
Q11: Each case in a switch statement must
Q12: Consider the following paint method to answer
Q13: How many times will the following loop
Q14: Given that s is a String, what
Q15: Control in a switch statement jumps to
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents