Ask Question
27 February, 16:16

What will be the output of the following code snippet? boolean token1 = true; while (token1) { for (int i = 0; i < 10; i++) { System. out. println ("Hello"); } token1 = false; }

+2
Answers (1)
  1. 27 February, 19:17
    0
    The output of the code snippet will be ten "Hello" messages

    Explanation:

    while token = true

    i = 0 sends "Hello" to the screen

    i = 1 sends "Hello" to the screen

    i = 2 sends "Hello" to the screen

    i = 3 sends "Hello" to the screen

    i = 4 sends "Hello" to the screen

    i = 5 sends "Hello" to the screen

    i = 6 sends "Hello" to the screen

    i = 7 sends "Hello" to the screen

    i = 8 sends "Hello" to the screen

    i = 9 sends "Hello" to the screen
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What will be the output of the following code snippet? boolean token1 = true; while (token1) { for (int i = 0; i < 10; i++) { System. out. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers