求助 DataOutputStream 输出是乱码怎么解决
程序如下,不知道为啥输出后txt文档里面是乱码。求助,怎么修改都还是一样……程序代码:
import import import public class OutPutData { public static void main(String[] args) throws Exception{ File f=new File("E:" + File.separator+"data.txt"); DataOutputStream put = new DataOutputStream(new FileOutputStream(f)); int no[]={2014001,2014002,2014003}; String name[]={"张三","张五","丽丽"}; float PE[]={75.5f,85f,98f}; float Math[]={85.5f,75.5f,78f}; for(int i=0;i<name.length;i++){ put.writeInt(no[i]); put.writeChar('\t'); put.writeChars(name[i]); put.writeChar('\t'); put.writeFloat(Math[i]); put.writeChar('\t'); put.writeFloat(PE[i]); put.writeChar('\n'); } put.close(); System.out.println("输出完成。"); } }