Created
May 7, 2020 14:14
-
-
Save chaitanyamannem/b7316e491bbeb78e913b05035f7c98f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.file.*; | |
import java.util.stream.*; | |
public class Main { | |
public static void main(String[] args) { | |
Stream<String> filenames = null; | |
try { | |
filenames = Files.lines(Paths.get("first.txt")); | |
}catch (IOException ioe){ | |
ioe.printStackTrace(); | |
} | |
if(filenames != null) | |
System.out.println("Printing content:\n" + filenames.collect(Collectors.toList())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment