Question: JAVA- L2A1 Write a Java program that allows a user to input multiple words. Your program should stop accepting words when the user enters STOP.

JAVA- L2A1

Write a Java program that allows a user to input multiple words. Your program should stop accepting words when the user enters "STOP". Store the words in an ArrayList. The word STOP should not be stored in the list.

Next, print the ArrayList, then print all the strings from this list in the reverse order to which they appear in the list, with each one on a new line, while adding the strings from the array in sequential order starting from the beginning.

Sample Run:

Please enter words, enter STOP to stop the loop. winter fall spring summer STOP [winter,fall,spring,summer] summerwinter springfall fallspring wintersummer 

Note: For this activity, you must use the class name, U7_L2_Activity_One and the method, main.

Hint: printing the entire ArrayList needs only one statement, however to print each String from the list individually on a new line starting from the last value, you will need to write a loop which starts at the end of the list and works backwards through it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!