Question: The following code segment is intended to count the number of words in the array with a length of less than or equal to 6.
The following code segment is intended to count the number of words in the array with a length of less than or equal to 6. String vocabulary [] = /* Assume array is initialized with Strings */; int c = 0; for (int i = 0; i < vocabulary.length; i++) { if ( /* Missing Code */) c++; } System.out.println("Number of words with length less than or equal to 6: " + c); Which line of code can be used to replace /* Missing Code */ so that the code segment works as intended?
| vocabulary.length[i]() <= 6 | ||
| vocabulary[i].length() <= 6 | ||
| vocabulary.length() < 6 | ||
| vocabulary[i].length() < 6 | ||
| vocabulary.length() <= 6 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
