I am using JOptionPane input method to ask the user to enter a word. I am doing this in a while loop, which ends when no word is entered into the window. What I am trying to do is store all the words entered into the window into an array. I am wondering if this is possible and if so how is it done.This is what I have so far.
public class SentenceReverse
public static void main(String args)
word = JOptionPane.showInputDialog(null, "Enter a word");
int n = word.length();
String firstWord = word;
if (n > 0)
int amountOfWords = 0;
while(n != 0)
String newWord = JOptionPane.showInputDialog(null, "Enter a word");
n = newWord.length();
String myArray = new String[amountOfWords];
//What do I do here to store Strings in myArray???