Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot read a file  RSS feed

 
Rocky Rocha
Ranch Hand
Posts: 40
Android Chrome Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My code is meant to take a string that the user typed into a text box and write to a file for later use, but it won't. It just creates an empty .txt file. here is my code
 
Norm Radder
Rancher
Posts: 2036
26
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code needs to make sure the data is written to the file out of where it is buffered in memory.
Either close the output file
or use try with resource to have the system close the file for you.
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!