/*Java DataInputStream class allows an application to read primitive data from the input stream in a machine-independent way. Java application generally uses the data output stream to write data that can later be read by a data input stream. */ /* Java DataOutputStream class allows an application to write primitive Java data types to the output stream in a machine-independent way. Java application generally uses the data output stream to write data that can later be read by a data input stream. */ import java.io.*; public class DataInOutTest { public static void main(String[] args) throws IOException { FileOutputStream file = new FileOutputStream("dout.txt"); DataOutputStream data = new DataOutputStream(file); data.writeInt(65); data.writeChar(' '); data.writeDouble(65.568); data.flush(); data.close(); System.out.println("Succcess..."); InputStream input = new FileInputStream("dout.txt"); DataInputStream inst = new DataInputStream(input); System.out.println(inst.readInt()); System.out.println(inst.readChar()); System.out.println(inst.readDouble()); } }