title: NotePad not recognizing new line characters in java code using PrintStream to output to text file
body: <p>I need some help with my java project for school. Please see the code below for the classes Book and BookApplication, as well as the input text file and desired output text file. </p>
  
  <p>I'm having an issue with the output file.  When I open it in Word or WordPad or NotePad++, the file is formatted correctly.  But when I open the file in NotePad, the report is all on one line.  </p>
  
  <p>For some reason NotePad is not recognizing the new line characters. Any thoughts on this?  How can I change the java code so that NotePad displays the report correctly?  I am a Java noob and I'm really struggling in this Java course.  Any help you can offer would be greatly apprecited. Thanks.</p>
  
  <p><i>The input text file called inBook.txt reads as follows:</i></p>
  
  <p>Intro to Java
  0123444555680
  Tony Gaddis
  TG003
  Intro to Javascript
  9780071632969
  John Pollock
  JP402
  Fundamentals of Game Development
  9780763778
  Heather Maxwell Chandler
  HC026</p>
  
  <p><i>The output text file called outBook.txt needs to read <b>exactly</b> as follows:</i></p>
  
  <p>Dean Publishers - List of Books</p>
  
  <p>Intro to Java
  By Tony Gaddis (TG003)
  ISBN: 0123444555680</p>
  
  <p>Intro to Javascript
  By John Pollock (JP402)
  ISBN: 9780071632969</p>
  
  <p>Fundamentals of Game Development
  By Heather Maxwell Chandler (HC026)
  ISBN: 9780763778</p>
  
  <p>Our current catalog has 3 books.</p>
  
  <p>Thank you for your interest.</p>
  
  <p>//  <b><i>Book.java</i></b></p>
  
  <pre><code>public class Book {
  
      public static final String BOOK_PUBLISHER = "Dean Publishers";
  
      private String bookTitle;
      private String bookISBN;
      private Author bookAuthor;
  
      Book(String inTitle) {
          setBookTitle(inTitle);
          setBookISBN("0");
          setBookAuthor("");
      }
  
      public void setBookTitle(String inTitle) {
          bookTitle = inTitle;
      }
  
      public void setBookISBN(String inISBN) {
          bookISBN = inISBN;
      }
  
      public void setBookAuthor(String inName) {
          bookAuthor = new Author(inName);
      }
  
      public void setBookAuthorID(String inID) {
          bookAuthor.setAuthorID(inID);
      }
  
      public String getBookTitle() {
          return bookTitle;
      }
  
      public String getBookISBN() {
          return bookISBN;
      }
  
      public Author getAuthor() {
          return bookAuthor;
      }
  
      public String getAuthorName() {
          return bookAuthor.getAuthorName();
      }
  
      public String getAuthorID() {
          return bookAuthor.getAuthorID();
      }
  
      //inner class
      class Author {
          private String authorName; //instance property
          private String authorID; //instance property
  
          //constructor
          Author(String inName)  {
              setAuthorName(inName);
              setAuthorID("0");
          }
  
          public void setAuthorName(String inName) {
              authorName = inName;
          }
  
          public void setAuthorID(String inID) {
              authorID = inID;
          }
  
          public String getAuthorName() {
              return authorName;
          }
  
          public String getAuthorID() {
              return authorID;
          }
      } //end inner Author class
  
  } //end Book class
  </code></pre>
  
  <p><b><i>BookApplication.java</i></b></p>
  
  <pre><code>import java.util.*;
  import java.io.*;
  
  public class BookApplication {
  
      public static void main(String[] args) throws IOException {
          // Create Book object for each book in the file and store them in array.
          Scanner filein = new Scanner(new File("inBook.txt"));
  
          // I will use ArrayList, a dynamic-size array
          ArrayList&lt;Book&gt; books = new ArrayList&lt;Book&gt;();
  
          while(filein.hasNextLine()) {
                // read book data
                String title = filein.nextLine();
                String isbn = filein.nextLine();
                String author = filein.nextLine();
                String authorID = filein.nextLine();
  
                // create new book from input
                Book temp = new Book(title);
                temp.setBookISBN(isbn);
                temp.setBookAuthor(author);
                temp.getAuthor().setAuthorID(authorID);
  
                // add to arraylist
                books.add(temp);
          }
  
          // Create an output report by reading the Book objects from the array.
          String output = "";
          for(Book book : books) {
             output += book.getBookTitle() + "\n";
             output += "By "+book.getAuthor().getAuthorName() + " (" + book.getAuthor().getAuthorID() + ")\n";
             output += "ISBN: " + book.getBookISBN() + "\n\n";
          }
  
          // Report prints to console
          System.out.println(output);
  
          // Report prints to file called outBook.txt
          PrintStream fileout = new PrintStream(new File("outBook.txt"));
          fileout.println(output);
          fileout.close();
  
          // Count the number of books outputted to the report.
          System.out.println("Our current catalog has " + books.size() + " books.");
          System.out.println("\nThank you for your interest.");
  
      } // end main method
  } // end BookApplication
  </code></pre>