Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package javaapplication1;
  7.  
  8. import java.io.IOException;
  9. import java.io.PrintWriter;
  10. import java.nio.charset.Charset;
  11. import java.nio.file.Files;
  12. import java.nio.file.Path;
  13. import java.nio.file.Paths;
  14. import java.util.Arrays;
  15. import java.util.List;
  16.  
  17. /**
  18. *
  19. * @author cl18205
  20. */
  21. public class JavaApplication1 {
  22.  
  23. /**
  24. * @param args the command line arguments
  25. */
  26. public static void main(String [] args) {
  27. try{
  28. List<String> lines = Arrays.asList("The first line", "The second line");
  29. Path file = Paths.get("C:\\Users\\cl18205\\Documents\\NetBeansProjects\\JavaApplication1\\src\\javaapplication1\\output.out");
  30. Files.write(file, lines, Charset.forName("UTF-8"));
  31. } catch(IOException exception){
  32. System.out.println(exception.getMessage());
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement