import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; public class MainClass { public static void main(String[] argv) { try { // Create the chain FileOutputStream fos = new FileOutputStream("txt"); DataOutputStream dos = new DataOutputStream(fos); // Write dos.writeDouble(123.456); dos.writeInt(55); dos.writeUTF("The moving finger writes"); // Close the chain dos.close(); fos.close(); } catch (IOException e) { } } }