写入到文档的是乱码!!!
import *;class CopyOfData_input_output
{
public static void main(String args[]) throws IOException
{
FileOutputStream fos=new FileOutputStream("b.txt");//打开一个输出文件
DataOutputStream dos=new DataOutputStream (fos);//数据输出流
try{ dos.writeBoolean(true);
dos.writeByte((byte)123);
dos.writeLong(998877665544332211L);
dos.writeShort((short)11223);
}
finally
{ dos.close(); }
DataInputStream dis=new DataInputStream(new FileInputStream("b.txt"));//数据输入流
try{ System.out.println("\t "+dis.readBoolean());
System.out.println("\t "+dis.readByte());
System.out.println("\t "+dis.readLong());
System.out.println("\t "+dis.readShort());
}
finally
{dis.close();}
}
}
为什么写入b.txt的是 ”{芄裉譪? “ 呢 ?