Your strings are stored in an array.
Arrays are accessed through the index number of their position in the array. Think of it like a train, where the engine is the first element, at position zero. The caboose is the last element, at position length - 1
So an array of 12 elements would have the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
myArray[2] would get the third element of the array (0, 1, 2...)
Decide which word (realistically which index of the array) you want to print, and print it, outside the loop.
Search keywords: java array access for more details on arrays.
Show the modified code if you have questions remaining, and remember code tags! Good luck
--- Update ---
Please do not post your question multiple times.
Threads merged