黑马程序员技术交流社区

标题: 关于BufferedOutputStream中的write()方法 [打印本页]

作者: the_way    时间: 2016-4-14 14:11
标题: 关于BufferedOutputStream中的write()方法
有一个复制文件的程序,输出时我写成了这样:
int len = 0 ;
byte[] bys = new byte[1024];
while((len=bis.read(bys)) != -1) {
          bos.write(bys);
}

这样程序还能实现 ,只是len变量示警“没有使用”
write方法不是write(byte[] b, int off, int len)  么
我没有定义长度 ,怎么不报错呢。




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2