line 1 writes the quoted text in Shree.txt file
even though the text is read at line 2 it worksout to be that s is null at line 3 and
there is no output
my question is why s becomes null at line 3 what should be done to read Shree.txt file
Thanks & Regards
Sumit Kothalikar
Tom Reilly
Rancher
Joined: Jun 01, 2010
Posts: 618
posted
0
Line 1 writes your text to the BufferedWriter - not the file. You need to call flush() and/or close() to write the text to the file. Then you can read it. Try moving bw.close() to just after line 1.
I changed the while code at line 3
but now it doesn't print anything.
Tom Reilly
Rancher
Joined: Jun 01, 2010
Posts: 618
posted
0
I think we've now fallen into the trap where you ask a follow-up question without first thinking it through yourself. Your problem now is not a misunderstanding about how an API works. It is a simple bug in your code.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35257
7
posted
0
Never do this:
You simply must handle IO exceptions; at least print a message to the log or system out so you know something bad happened.