title: how to create a file in a specific folder on desktop by default
body: <p>I am trying to create a file with data inputted by user. But, I want that to be saved on a new folder on desktop every time user runs it. How can I do that?</p>
  
  <pre><code>package my.io;
  import java.io.BufferedWriter;
  import java.io.FileWriter;
  import java.util.Scanner;
  
  public class BufferReader {
  
      public static void main(String args[]){
  
          System.out.print("Please enter your text!!: ");
          Scanner ip = new Scanner(System.in);
          String text = ip.nextLine();
          FileWriter fWriter = null;
          BufferedWriter writer = null;
          try {
            fWriter = new FileWriter("text.txt");
            writer = new BufferedWriter(fWriter); 
            writer.write(text);
            writer.newLine();
            writer.close();
            System.err.println("Iput of " + text.length() + " characters was saved on Desktop.");
            System.out.println("Text you have entered is:" + (ip.nextLine()));
          } catch (Exception e) {
              System.out.println("Error!");
          }
  
      }
  
  }
  </code></pre>