Consider the code: while(false) { System.out.println("Hello"); }. How many times will "Hello" be printed?

  • 0
  • 1
  • 5
  • It will not be printed at all.
"Hello" will not be printed at all because the condition in the while loop is false from the start. In a while loop, the code block inside the loop will only execute if the condition is true. Since the condition is false, the code block is never executed.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *