140k views
4 votes
Use the following initializer list:

w = ["Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]

Write a loop to print the words that start with "F" or "L".

Sample Run:
Logic
Filter
Functionality

User Sunwukung
by
6.8k points

1 Answer

1 vote

Answer:

Here's the Java code to print the words that start with "F" or "L":

String[] w = {"Algorithm", "Logic", "Filter", "Software", "Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"};

for (String word : w) {

if (word.startsWith("F") || word.startsWith("L")) {

System.out.println(word);

}

}

Step-by-step explanation:

Output:

Logic

Filter

Functionality

User Thomas Schmidt
by
7.1k points