Java read text file in lines, but seperate words in lines into array
问题 I am trying to write a code that looks at a text file, and does a while loop so that it reads each line, but I need each word per line to be in an array so I can carry out some if statements. The problem I am having at the moment is that my array is currently storing all the words in the file in an array.. instead of all the words per line in array. Here some of my current code: public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("test.txt")); List