aspose file tools*
The moose likes I/O and Streams and the fly likes Why no output is given here Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Why no output is given here " Watch "Why no output is given here " New topic
Author

Why no output is given here

Abhra Kar
Ranch Hand

Joined: May 22, 2008
Posts: 124
import java.io.*;

class File6{
public static void main(String[] s){
try{
File file = new File("f.txt");
FileWriter fw = new FileWriter(file);

fw.write("who is next\nI don't know\nok no problem");

FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);

String data;
while((data=br.readLine()) !=null)
System.out.println(data);

br.close();

}catch(IOException io){io.printStackTrace();}

}
}


This code is not showing any output .
I can't make out the problem , please help
Thanks in advnce
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
fw.flush() after fw.write()!
Abhra Kar
Ranch Hand

Joined: May 22, 2008
Posts: 124
Thanks for the help
I have made a bad mistake
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why no output is given here