黑马程序员技术交流社区
标题:
谁给理解下大神
[打印本页]
作者:
细节是成功妻子
时间:
2016-6-5 23:48
标题:
谁给理解下大神
public class Demo {
public static void main(String[] args) {
InputStream in = null;
try {
in = new FileInputStream("D:\\sogou.exe");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
OutputStream out = null;
try {
out = new FileOutputStream("sogou.exe");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
byte[] b= new byte[1024];
int len = 0;
try {
while((len=in.read(b))!= -1){
out.write(b,0,len);
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if(in != null){
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
try {
if(out != null){
out.close();
}
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("复制完毕!");
}
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2