title: Create a file in an existing folder-java
body: <p>I'm new in Java and i still try to learn but i have a little problem with this task..So, i have to open a dialog box for choose a folder that already exists and i have to create a file inside this folder! i have write the code to choose the folder but now i have to create the file. i found some ways to do it but i only made the file outside from the folder! here is what i write so far:</p>
  
  <pre><code>    JFileChooser folderChooser = new JFileChooser();
      folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      int user = folderChooser.showSaveDialog(null);
      if (user == JFileChooser.APPROVE_OPTION) {
      File folder = folderChooser.getSelectedFile();
  
      File f = new File("test.txt");
      f.createNewFile();
  </code></pre>
  
  <p>can someone help me?</p>