title: JFileChooser doesn't stop running
body: <p>I've been trying to use JFileChooser but I have the problem that the program doesn't stop running, here's my code:</p>
  
  <pre><code>import java.io.File;
  import javax.swing.JFileChooser;
  import javax.swing.JFrame;
  
  public class copiarArcivos {
  
      public static void main(String[] args) {
         JFileChooser();
      }
  
      public static void JFileChooser(){
          JFileChooser fileChooser = new JFileChooser();
          fileChooser.setCurrentDirectory(new File(System.getProperty("user.home")));
          int result = fileChooser.showOpenDialog(new JFrame());
          if (result == JFileChooser.APPROVE_OPTION) {
              File selectedFile = fileChooser.getSelectedFile();
              System.out.println("Selected file: " + selectedFile.getAbsolutePath());
          }
      }
  }
  </code></pre>
  
  <p>Should I simply put a break at the end of the if?</p>