Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void escribir(String mensaje) {
- FileWriter fichero = null;
- PrintWriter pw = null;
- if()
- try {
- fichero = new FileWriter("./prueba.txt");
- pw = new PrintWriter(fichero);
- pw.append(mensaje);
- JOptionPane.showMessageDialog(null,"Texto Guardado");
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- // Nuevamente aprovechamos el finally para
- // asegurarnos que se cierra el fichero.
- if (null != fichero) {
- fichero.close();
- }
- } catch (Exception e2) {
- e2.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement