Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.File;

import javax.swing.JFileChooser;

public class Main {
    public static void main(String[] args) {
        // Display an open file chooser

        JFileChooser fileChooser = new JFileChooser();

        int returnValue = fileChooser.showOpenDialog(null);

        if (returnValue == JFileChooser.APPROVE_OPTION) {
            File selectedFile = fileChooser.getSelectedFile();
            System.out.println("we selected: " + selectedFile);
        }

    }
}