Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package Main;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.nio.charset.StandardCharsets;
  6. import java.nio.file.Files;
  7. import java.nio.file.Paths;
  8. import java.util.List;
  9. import java.util.StringTokenizer;
  10.  
  11. public class Main {
  12.  
  13. public static void main(String[] args) throws IOException {
  14. File file = new File("FileToRead.txt");
  15. List<String> lines = Files.readAllLines(Paths.get(String.valueOf(file)), StandardCharsets.UTF_8);
  16. String s = lines.toString();
  17. StringTokenizer st = new StringTokenizer(s, " \n\r");
  18.  
  19. while (st.hasMoreTokens()) {
  20. System.out.println(st.nextToken());
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement