java - Read a Single String from a File at a Time -
abe bobby joseph yyvoynne kathryn
^^ file i'm reading from. how go reading in 1 word @ time,assigning 1 word variable, doing stuff it, reading in name file? i'm getting stuck on how assign word read in variable. time.
while(names.hasnext()) { //stuff }
i think looking reading line line file.
you can try this: common way read files.
bufferedreader br = new bufferedreader(new filereader(file)); string line; string word; while ((line = br.readline()) != null) { word = line; //do stuff word } br.close();
Comments
Post a Comment