Ejemplo de uso de JFileChooser
Equation 
Un ejemplo que emplea JFileChooser para seleccionar un archivo es
```
package chooser;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
public class SampleJFileChooser {
public SampleJFileChooser(){
JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setCurrentDirectory(new File("/User/alvinreyes"));
int result = jFileChooser.showOpenDialog(new JFrame());
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = jFileChooser.getSelectedFile();
System.out.println("Selected file: " + selectedFile.getAbsolutePath());
}
}
public static void main(String[] args) {
new SampleJFileChooser();
}
}
```
ID:(8863, 0)
Ejemplo de Lectura y Escritura
Script 
La siguiente rutina lee un archivo y graba su contenido en un segundo archivo:
```
import java.io.*;
public class CopyFile {
public static void main(String args[]) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("input.txt");
out = new FileOutputStream("output.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
}finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}
```
ID:(8864, 0)
