import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class DocGhiFile { private static final String FILENAME = "data.txt"; public static void main(String[] args) { try (BufferedWriter bw = new BufferedWriter(new FileWriter(FILENAME))) { String content = "1234567890\n"; bw.write(content); //Thông báo System.out.println("Đã ghi file thành công!!!!"); } catch (IOException e) { e.printStackTrace(); } } }