import java.io.*; public class WriteBinaryData { public static void main(String[] args) throws IOException { // Use try-with-resources to ensure proper resource management try (DataOutputStream dos = new DataOutputStream(new FileOutputStream("data1.txt"))) { dos.writeInt(42); dos.writeDouble(3.14159); dos.writeUTF("Hello, PVPSIT!"); } } }