huyi

BlogJava 首页 新随笔 联系 聚合 管理
  46 Posts :: 5 Stories :: 5 Comments :: 0 Trackbacks

import java.io.*;
public class TestRead {

 public static void main(String[] args)
 throws IOException//是系统提示才写上的。不懂为什么。
  {
  byte f = 1;
  byte b = 2;
  byte c = 3;
  byte[] a={f,b,c};
  
  File file = new File("c:\\MyClass.txt");
  FileOutputStream out=new FileOutputStream("c:\\MyClass.txt");
  
  
  out.write(a);// 这个方法只能接受数组形式。
  out.close();
  }
}

写的不像是面象对象的东西。~:(

posted on 2005-03-25 16:40 HuYi's Blog 阅读(227) 评论(1)  编辑  收藏 所属分类: Java

Feedback

# re: first day. 2005-03-25 19:28 HuYi's Blog
throws IOException//是系统提示才写上的。不懂为什么。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
这是IO操作可能抛出的异常,需要捕获。

out.write(a);// 这个方法只能接受数组形式。
~~~~~~~~~~~~~~~~~~~~~~~~~~
不对,可以接受字符串之类  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: