167k views
3 votes
Create a List with People's name you are thankful for. Create a While loop that goes thru the list and prints a thank you note to them.

plsss helpp mee
tell me the code

1 Answer

5 votes

Answer:

public static void main(String[] args) {

// List of the people

String[] myArray = {"John", "Jack", "Luke", "Ali", "Zara"};

// Saving the length of the array

int length = myArray.length;

// Used for checking the index of myArray and printing out each element

int counter = 0;

while (counter < length){

// Printing the note

System.out.println("Thank you, " + myArray[counter]);

counter++; // Moving to the next index

}

}

Step-by-step explanation:

The code is written in Java. If you need help with modifying it for another language, let me know!

User PixelsTech
by
7.7k points

Related questions

asked Sep 14, 2022 8.7k views
Jo VdB asked Sep 14, 2022
by Jo VdB
8.5k points
2 answers
22 votes
8.7k views