怎么读入数据到文件中?? 如果有各种类型数据,按顺序读入,按顺序读出,怎么保证进去的是什么样出来的也是什么样呢是之前处理好,全部转换成某种类型的数组读到文件中,再读出反过来处理还是用什么其它方法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Yes, you're right! If it's an Object, read it as an Object; if it's an int variable, read it as an int. 建议你可以使用DataInputStream 和 DataOutputStream ,然后套接FileInputStream ,FileOutputStream,即可实现不同数据类型的读入,读出;建议看下DataInputStream的API,有很多针对基本类型的输入方法 那么应该怎么处理我上面说到的情况呢import java.io.*;public class test{ public static void main(String[] args){ try{ byte count=0;; byte a[]=new byte[10]; for(byte i:a) i=count++; OutputStream m=new FileOutputStream("E:/1.txt"); m.write(a); System.out.println(a); InputStream n=new FileInputStream("E:/1.txt"); byte b[]=new byte[10]; n.read(b); System.out.println(b); } catch(Exception e) { System.out.println(e); } } }怎么结果是这个,两个结果不一样?[B@11b86e7[B@35ce36 如何动态注入一个对象? 怎么会出现:警告:<applet> 标记需要高度属性 JTABLE列移动问题 用java能开发游戏外挂吗 求一个写文件的代码,要求不覆盖原来的文件 如何在hibernate3中,根据*.hbm.xml文件生成POJO类? import关键字该如何使用? 有一个类 extends Canvas,重载了 paint 方法,如何使没有画有内容的地方透明? 代码中是怎么调用compareTo方法的 这样的错误是为什么????? java对txt文件排版 applet打不开页面,怎么不提示下载插件
public static void main(String[] args){
try{
byte count=0;;
byte a[]=new byte[10];
for(byte i:a) i=count++;
OutputStream m=new FileOutputStream("E:/1.txt");
m.write(a);
System.out.println(a);
InputStream n=new FileInputStream("E:/1.txt");
byte b[]=new byte[10];
n.read(b);
System.out.println(b);
}
catch(Exception e)
{
System.out.println(e);
}
}
}怎么结果是这个,两个结果不一样?
[B@11b86e7
[B@35ce36