Read next word in java

前端 未结 5 1440
广开言路
广开言路 2020-11-27 18:08

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 t

5条回答
  •  时光取名叫无心
    2020-11-27 19:10

    You already get the next line in this line of your code:

     String line = sc.nextLine();  
    

    To get the words of a line, I would recommend to use:

    String[] words = line.split(" ");
    

提交回复
热议问题