Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication1;
- import java.io.IOException;
- import java.io.PrintWriter;
- import java.nio.charset.Charset;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.util.Arrays;
- import java.util.List;
- /**
- *
- * @author cl18205
- */
- public class JavaApplication1 {
- /**
- * @param args the command line arguments
- */
- public static void main(String [] args) {
- try{
- List<String> lines = Arrays.asList("The first line", "The second line");
- Path file = Paths.get("C:\\Users\\cl18205\\Documents\\NetBeansProjects\\JavaApplication1\\src\\javaapplication1\\output.out");
- Files.write(file, lines, Charset.forName("UTF-8"));
- } catch(IOException exception){
- System.out.println(exception.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement