Source of TestNewline.java


  1: //TestNewline.java
  2: 
  3: import java.io.PrintWriter;
  4: import java.io.FileNotFoundException;
  5: 
  6: public class TestNewline
  7: {
  8:     public static void main(String[] args)
  9:     {
 10:         PrintWriter outputStream = null;
 11:         try
 12:         {
 13:             outputStream = new PrintWriter("out.txt");
 14:             outputStream.println("one\ntwo\nthree");
 15:             outputStream.println("one");
 16:             outputStream.println("two");
 17:             outputStream.println("three");
 18:             outputStream.close();
 19:             System.out.println("End of program.");
 20:         }
 21:         catch(FileNotFoundException e)
 22:         {
 23:             System.out.println("Error opening the file out.txt.");
 24:             System.exit(0);
 25:         }
 26:     }
 27: }
 28: