Read next word in java

Posted by ArtWorkAD on Stack Overflow See other posts from Stack Overflow or by ArtWorkAD
Published on 2011-01-01T12:26:24Z Indexed on 2011/01/01 12:53 UTC
Read the original article Hit count: 285

Filed under:
|

Hi,

I have a text file that has following content:

ac und
accipio annehmen
ad zu
adeo hinzugehen
...

I read the text file and iterate through the lines:

Scanner sc = new Scanner(new File("translate.txt"));
while(sc.hasNext()){
 String line = sc.nextLine();       
}

Each line has two words. Is there any method in java to get the next word or do I have to split the line string to get the words?

© Stack Overflow or respective owner

Related posts about java

Related posts about java-util-scanner