SyntaxFix
Write A Post
Hire A Developer
Questions
Here's the modern, safe one liner:
java.nio.file.Files.write(java.nio.file.Paths.get("/tmp/output.txt"), "Hello world".getBytes());
nio is a modern IO library shipped by default with the JDK 9+ so no imports or dependencies required.