Like the title says, im trying to write a program that can read individual words from a text file and store them to String variables. I know how to use a
String
These are all really complex answers. And I am sure they are all useful. But I prefer the elegantly simple Scanner :
Scanner
public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(new File("fileName.txt")); while(sc.hasNext()){ String s = sc.next(); //..... } }