Question: how to use jfilechooser in java?
Answer: Add required import statements: import javax.swing.JFileChooser; ... 
Create a new instance ofJFileChooser class: JFileChooser fileChooser = new JFileChooser();
Set current directory: ... 
Show up the dialog: ... 
Check if the user selects a file or not: ... 
Pick up the selected file: ... 
And the whole code snippet is as follows: