Start by stopping and thinking about what you are doing - so far, you have grabbed your homework, created a source file and jumped straight into coding! That's not the way to go.
Start by reading the question carefully, and working out the data flow - what data you need to be handling, and where does it it to go?
You need to read a file and break it into words: you have created a method to do that and called it, but ... make it return the data. Yes, you have a global called
wordList
but you don't do anything with it, because the
readInput
method "hides" it behind a local variable of the same name, and returns no value at all.
Throw the global version away, and have
readInput
return the collection of words.
Then you can start working on making
readInput
do what it is supposed to: handle words.
Are words the same as lines? Is this line one word? I think not!
You need to have a collection of collections: each of the inner collection holds each character of the word as a separate item, but only holds one word, not a whole line. For the line above that would be:
'A','r','e'
'w','o','r','d','s'
't','h','e'
's','a','m','e'
'a','s'
'l','i','n','e','s','?'
'I','s'
't','h','i','s'
'l','i','n','e'
'o','n','e'
'w','o','r','d','?'
'I'
't','h','i','n','k'
'n','o','t','!'
With each word in a separate collection. So yo do that, you need to read lines, and then break them into individual words.
Your instructions are pretty well refined already, but have a look here: If you are having problems getting started at all, then this may help:
How to Write Code to Solve a Problem, A Beginner's Guide[
^] it may help you to start working out how to think about a problem and solve it!
Give it a try!