请问哪里错了???怎么修改importjava.io.*;publicclasszuoye2{publicstaticvoidmain(Stringargs[])throwsIOException{FileReaderfr1=newFileReader("d:\\wen1.txt");FileReaderfr2=...
请问哪里错了???怎么修改
import java.io.*;
public class zuoye2 {
public static void main(String args[])throws IOException{
FileReader fr1=new FileReader("d:\\wen1.txt");
FileReader fr2=new FileReader("d:\\wen2.txt");
BufferedReader br1=new BufferedReader(fr1);
BufferedReader br2=new BufferedReader(fr2);
BufferedWriter bw1=new BufferedWriter(new FileWriter("D:/wen3.txt"));
int lineNum=0;
String s,s1,s2;
System.out.println("输入文件是:c:\\wenjian12.txt\n输出文件是:c:\\wenjian3.txt");
s1=br1.readLine();
s2=br2.readLine();
while(s1!=null) {
lineNum++;
bw1.write(String.valueOf(lineNum));
bw1.write(": ");
bw1.write(s1);
bw1.newLine();
s=br1.readLine();
}
bw1.close();
while(s2!=null) {
lineNum++;
bw1.write(String.valueOf(lineNum));
bw1.write(": ");
bw1.write(s2);
bw1.newLine();
s=br2.readLine();
}
bw1.close();
}
}
展开