标题:求助 DataOutputStream 输出是乱码怎么解决
取消只看楼主
小月饼
Rank: 1
等 级:新手上路
帖 子:7
专家分:4
注 册:2013-11-3
结帖率:66.67%
已结贴  问题点数:20 回复次数:0 
求助 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("输出完成。");
    }

}
搜索更多相关主题的帖子: color 
2014-11-23 19:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-439062-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.104172 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved