Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Jenya Mia
Added: Mar 19, 2019 12:30 PM
Views: 8
Tags: file java
  1. Path path = Paths.get("src/main/resources/shakespeare.txt");
  2. try
  3. {
  4.  
  5.  Files.lines(path).forEach(System.out::println);//print each line
  6.  
  7. }
  8. catch (IOException ex)
  9. {
  10.  ex.printStackTrace();//handle exception here
  11. }