My problem is that I am unable to assign a value from a .txt with a list of words, to an array. I believe the issue is that I am asking for something that is not yet available, like asking for something from the future without knowing it. This is my code, any help will be appreciated along with any tips.
File words = new File("wordList.txt"); //document with words
String wordToArray = new String();
String[] arrWord = new String[3863]; // number of lines
Scanner sc = new Scanner(words);
Random rWord = new Random();
int i = 0;
do
{
wordToArray = sc.next(); //next word
arrWord[i] = wordToArray; //set word to position
i++; //move to next cell of the array
sc.nextLine(); //Error occurs here
}while(sc.hasNext());