Following Code Many Times Would Loop Execute 2 Stringtokenizer St New Stringtokenizer Quic Q37254255

For the following code, how many times would the while loop execute? 2. StringTokenizer st = new StringTokenizer(The quick bFor the following code, how many times would the while loop execute? 2. StringTokenizer st = new StringTokenizer(“The quick brown-fox jumped over the lazy dog while (st.hasMoreTokens0) System.out.println(st.nextTokenO): Show transcribed image text For the following code, how many times would the while loop execute? 2. StringTokenizer st = new StringTokenizer(“The quick brown-fox jumped over the lazy dog while (st.hasMoreTokens0) System.out.println(st.nextTokenO):


Answer


There are 8 words in the sentence.

1)The

2)quick

3)brown-fox

4)jumped

5)over

6)the

7)lazy

8)dog

So,

8(eight) times the while loop executes.

The loop iterates for each word

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.