Thursday, April 22, 2010

DataWrite ใช้ได้กับ Byte เท่านั้น

// DataWrite.java

import java.io.*;

class DataWrite {

    public static void main(String args[]) throws IOException {

        DataOutputStream dos = new DataOutputStream(System.out);

        int x = 12345;

        double y = 1.2345;

        dos.writeInt(x);

        dos.writeDouble(y);

        dos.close();

    }

}

No comments:

Post a Comment