This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why no output is given here

 
Abhra Kar
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fw.flush() after fw.write()!
 
Abhra Kar
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help
I have made a bad mistake
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic