package c;import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;public class TestOut { public TestOut(){
File f1 = new File("c:\\1.txt");
File f2 = new File("c:\\2.txt");
try {
FileOutputStream fos1 = new FileOutputStream(f1);
byte buf[] = "hello".getBytes();
fos1.write(buf);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
FileInputStream fis = new FileInputStream(f1);
FileOutputStream fos2 = new FileOutputStream(f2);
int c;
while((c=fis.read())!=-1){
fos2.write(c);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

}
public static void main(String[] args) {
new Test();
}}我想要实现的效果是创建2个文本 1和2
1文本的内容为hello word
2文本复制1文本的内容。
前提是没有这两个文本。
不知道明白了没?