Writing to a file from the console

  • 16
Now you need to write something to a file. You need to first read the file name from the console, then read lines entered by the user until the user enters "exit". Finally, write all the entered lines to the file, each on a new line.
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
MICHAEL DUNLAPLevel 19 , Bellevue
22 August 2019, 05:17
Finally got it to pass. My condition for checking for "exit" had to go at the very bottom of the while loop to pass the 4th condition. Also, the 5th requirement is tricky. I wasn't passing it until I commented out the line that adds the name of the file as a line in the file. The requirement does state that ALL entered lines must be in the file-- would this not include the entered name of the file? Apparently not.
MICHAEL DUNLAPLevel 19 , Bellevue
22 August 2019, 04:46
I'm stumped. It works fine in the Intellij, but I'm overlooking some case that needs to be addressed. Any hints? Many thanks.
ProfjLevel 20 , Lagos
19 June 2019, 22:25
But seriously. I'm not sure I encountered a lesson that dealt with all these read and write into file stuff.
Pablo SouzaLevel 22 , Brisbane
8 April, 23:34
It should be clear by now that this is a point this course tries to make. You have to learn to figure things out by yourself, because that's how it works in real life. :-)