import java.io.*;
import javax.swing.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
public class Demo1 {
public static void main(String[] args) throws IOException{
File f = new File("f:\\","a.txt");
File f1 = new File("f:\\","b.txt"); // 将F盘里面的a.txt 和 b.txt封装成对象..
f.createNewFile(); //创建a,txt
FileWriter fw = new FileWriter(f);
fw.write("abcdefg"); //像对象f中写入数据"abcdefg"
FileInputStream in = new FileInputStream(f);
FileOutputStream out = new FileOutputStream(f1);
int c ;
while((c = in.read()) != -1)
out.write(c);
fw.close();
out.close();
}
}
求大神教我从FileInputStream 到 out.close();
这边的意思, 小弟我咋不懂呢= =..
import javax.swing.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
public class Demo1 {
public static void main(String[] args) throws IOException{
File f = new File("f:\\","a.txt");
File f1 = new File("f:\\","b.txt"); // 将F盘里面的a.txt 和 b.txt封装成对象..
f.createNewFile(); //创建a,txt
FileWriter fw = new FileWriter(f);
fw.write("abcdefg"); //像对象f中写入数据"abcdefg"
FileInputStream in = new FileInputStream(f);
FileOutputStream out = new FileOutputStream(f1);
int c ;
while((c = in.read()) != -1)
out.write(c);
fw.close();
out.close();
}
}
求大神教我从FileInputStream 到 out.close();
这边的意思, 小弟我咋不懂呢= =..