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
5.2k points