Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Paths;
- import java.util.stream.Stream;
- public class FileRead {
- public static void main(String[] args) {
- String name = "nilesh.list";
- try (Stream<String> lines = Files.lines(Paths.get(name))) {
- lines.forEach(System.out::println);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement