title: How to create a .txt file within the java project folder and write to it
body: <p>I am attempting to create a text file within my project folder (not within the src but the System library). I have already created a print to display the proper info in the correct format. I copied and pasted this and edited the "System.out.println" to "PrintWriter.println". I am not sure if this code is correct although it shows no errors. </p>
  
  <pre><code>try {
          File file = new File("SortedLists.txt");
          FileWriter w = new FileWriter("SortedLists.txt");
          writer = new PrintWriter(w);
  
          for(Team p: roster){
              writer.println("Team Name: "+p.gettName()+", "+p.gettAbrv());
              for(Riders r: p.getRide()) {
                  writer.println(r);
              }
              writer.printf("Total Team Donations: %.2f$\n",p.getSumD());
          }
      }
      catch(IOException e) {
          System.out.println(e.getMessage());
      }
      finally {
          writer.close();
      }
  </code></pre>