Created
August 9, 2019 01:45
-
-
Save parzibyte/7c1f36dfe1c12472a62963814b8dca5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileWriter; | |
import java.io.BufferedWriter; | |
import java.io.IOException; | |
/* | |
Escribir un archivo de texto con Java | |
https://parzibyte.me/blog | |
*/ | |
class Main { | |
public static void main(String[] args) { | |
String nombreArchivo = "ejemplo.txt"; | |
try { | |
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(nombreArchivo)); | |
bufferedWriter.write("Programando en Java\n"); | |
bufferedWriter.write("parzibyte.me\n"); | |
bufferedWriter.close(); | |
} catch (IOException e) { | |
System.out.println("Error escribiendo en archivo: " + e.getMessage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment