Hello, im new to this forum. And pretty new to java programming. I made this note system, so i have control over my notes at school. It will take in a name (philosophname) and store it in a .txt file named navn.txt and it also have a .txt file where i put in the notes in notat.txt.
my problem now is, when i add a new name i get this error. the name is stored in the file. and i can see the new name but i want to not get this error, so that i dont have to restart the program.
"None are more hopelessly enslaved than those who falsely believe they are free" - Johann Wolfgang von Goethe
Take out all of your close System.in statements, ie "sc.close()" and "f.close()". Should work like a charm from there, also you might want to type check so that there is a catch in the menu if the user inputs a noninteger so that it doesn't just crash.
omg, that easy o.O exactly why did that make that kind of error?
and btw, i will need the "f.close()" orelse it wont store into the .txt file + i have learned on school always to close the file you write to when you open it and finished with it.
but a new "problem" happend now. i do not get the error, but when i write new name i have to Exit(opt 10 in meny) to update the allname list.
yes tnx, will work with the checks on the meny.
Joined: Dec 15, 2012
I believe the whole problem is coming from wanting to read and write the same file without having ever saved it. There are many ways to get around this one may be using a RandomAccessFile.