import java.io.FileWriter;
import java.io.IOException;
public class App {
public void writeCharacters(String filePath, String content) {
try (FileWriter writer = new FileWriter(filePath)) {
writer.write(content);
System.out.println("Successfully wrote " + content.length() + " characters to file");
} catch (IOException e) {
System.err.println("Error writing to file: " + e.getMessage());
}
}
public static void main(String[] args) {
App app = new App();
String message = "Hello, YX1X-X(X'! p This is a UTF-8 encoded text message.";
app.writeCharacters("message.txt", message);
}
}