Question: You are going to develop a method that takes an ArrayList of strings as a parameter, iterates through that ArrayList and greets every element in
You are going to develop a method that takes an ArrayList of strings as a parameter, iterates through that ArrayList and greets every element in it with "Hello" followed by a newline.
mport java.util.;
public class LabChallenge
add code below this line
add code above this line
public static void mainString args
ArrayList names new ArrayList;
for String s : args
names.adds;
sayHellonames;
Hint : You can start your method with public static void sayHelloArrayList variable Then iterate through variable using a loop in order to print Hello to each element in variable. You can also review the reading question in "Alternative Parameters" in the "Parameters" assignment.
Requirements:
Don't change the exisitng code
You can use any number of additional methods youd like but you must include at least the method called sayHello in your code.
Compile and test your code with different value :
Compile and test with Alan and Bob
Expected output : Hello Alan
Hello Bob
Compile and test with
Expected output:
Hello
Hello
Hello
Thank you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
