public class ReadWriteFile{
	static File f1 = new File("C:\\source.txt");
	static File f2 = new File("C:\\dest.txt");
	public String readFile() throws IOException
		String msg = "";
		FileReader fr = new FileReader(f1);
		BufferedReader br = new BufferedReader(fr);
		msg = br.readLine();
		return msg;
	public void writeFile(String str) throws IOException
		FileWriter fr = new FileWriter(f2);
		BufferedWriter br = new BufferedWriter(fr);

public class Entry {
	public static void main(String[] args){
		ReadWriteFile f1 = new ReadWriteFile();
		try {
		catch(IOException e)

What's wrong with this code? I am not getting any output file in the end and no errors nothing..

Apart from this What are the best methods to read n write data. Preferably nice tutorial to explain differences between different type of read/write methods. please don't redirect me to sun site.

Close the bufferedwriter and not the file writer. By closing the filewriter you are probably preventing the bufferedwriter from flushing.

still no use. first question, the data itself from the file is not getting read and surprisingly no error is being thrown.

Then the first line is a blank line (or there are no lines, but then it would print null) and you are only reading one line. Also, if you can't work with the Sun tutorials no other's will help you either. The advice about closing the outer most reader/writer still stands.

Edit: Aack, you also need printStacktrace, not getStacktrace.