A few days ago, i made a hangman game and I really want to complete it in any aspect. One of my ideas now is to "import" words from a file. Currently what I have is an Array of Strings (just a few words inside for testing) and what I want is a file containing those 2:Word
Hint
word1 Hint1 with spaces
word2 Hint2 with spaces
What I am wondering now is can I import the file and all its context into an array maybe? and then when the game starts use regular expressions such as randomly take a row from the size of the file , then write to the GUI as the word to guess the contense of the row up to the first empty space and then after the space write the contense as Hint area in the GUI. I've had some experience with regular expressions, would they be able to give me the word/hint ? Or any other ways would be appreciated. Also, if this won't work what about 1 file hints, 1 file words, import into ArrayLists and then just get the index of a word and use the same index to get the hint from the other arraylist?