QUOTE(Runesmith @ 1 May, 2008 - 11:56 AM)

Thanks, PBL! That took away some of the errors. I'm still getting errors around the BufferedReader lines ("Can't find ( or ]") and the temp.length line (It's highlighting .length, and saying it 'can't find symbol'), and I don't quite understand why this is happening. Here's my code at the moment:
What you are doing is reading all file1 then all file2 cumulating them in temp1 and temp2
that is not what you want, you want it line per line
3 typos and unhandled exception
FileWriter has a method to write a String no need to convert into a char[]
This should do the trick
java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
public class Main {
public static void main(String[] args) {
try {
FileReader file1=new FileReader("Data1.txt");
FileReader file2=new FileReader("Data2.txt");
BufferedReader br1 = new BufferedReader(file1); // remove the "of"
BufferedReader br2 = new BufferedReader(file2); // removed the "of"
FileWriter fw=new FileWriter("data3.txt");
String temp1, temp2;
temp1 = br1.readLine();
while(temp1 != null) {
temp2 = br2.readLine();
fw.write(temp1 + temp2);
// read next line
temp1 = br1.readLine();
}
file1.close();
file2.close();
fw.close();
}
catch (Exception e) {
System.out.println("Error opening/reading/writing file: " + e);
}
}
}
Have fun... I am not sure about the write(String) method in a FileWriter may be (I said MAY BE) you have to add a new line at the end of the line so it would be
fw.write(temp1 + temp2 + "\n");
This post has been edited by pbl: 1 May, 2008 - 11:39 AM