Hi, Can anyone teach me how can I save a chosen file to a specific directory. I have used FileDialog to allow users to search the file that they wanted.



import java.awt.Button;
import java.awt.FileDialog;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MainClass extends Frame {
FileDialog open;

MainClass() {
super("MainClass");
setSize(200, 200);

open = new FileDialog(this, "Choose a file", FileDialog.LOAD);
open.setDirectory("C:\\");

Button b;
add(b = new Button("Browse...")); // Create and add a Button
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fc.setVisible(true);
String fn = fc.getFile();
if (fn == null)
System.out.println("You cancelled the choice");
else
System.out.println("You chose " + fn);
}
});
}

public static void main(String[] a) {
new MainClass().setVisible(true);
}
}

Please tell me how to save the selected file thank you.