import java.io.*; public class DataStreamTest { public static void writeTest() throws IOException { String path="C:\\Godoro\\Publishing\\JavaDeeply\\Code\\" + "JavaDeeplyCertified\\JavaDeeplyCertified\\test\\out.txt"; FileOutputStream file=new FileOutputStream(path); DataOutputStream out=new DataOutputStream(file); boolean myBoolean=true; out.writeBoolean(myBoolean); byte myByte=127; out.writeByte(myByte); char myChar='A'; out.writeChar(myChar); double myDouble=16.5; out.writeDouble(myDouble); int myInt=123; out.writeInt(myInt); String myString="ABC"; out.writeUTF(myString); out.close(); } public static void readTest() throws IOException { String path="C:\\Godoro\\Publishing\\JavaDeeply\\Code\\" + "JavaDeeplyCertified\\JavaDeeplyCertified\\test\\out.txt"; FileInputStream file=new FileInputStream(path); DataInputStream in=new DataInputStream(file); boolean myBoolean=in.readBoolean(); System.out.println("Boolean : "+myBoolean); byte myByte=in.readByte(); System.out.println("Byte : "+myByte); char myChar=in.readChar(); System.out.println("Char : "+myChar); double myDouble=in.readDouble(); System.out.println("Double : "+myDouble); int myInt=in.readInt(); System.out.println("Int : "+myInt); String myString=in.readUTF(); System.out.println("String : '"+myString+"'"); } public static void main(String[] args) throws IOException { readTest(); } }Dosyayı İndir