av Nathan Hyman för 3 årar sedan
105
Mer av detta
Keep in mind that the array should be visualized vertically, just for correctness. Technically in memory there is no actual directionality to the data's storage, but if asked, illustrate it as a vertical array.
Each line of the array is like a new element, and each even has their own index, like an array!
Understanding where a file can be accessed is essential for understanding computers as a whole, as every file is organized SOMEWHERE
Files, folders, drives, devices, these are all levels of organization
.txt specifies that something is a text file, this is EVEN done when writing a file name in quotes.
When declaring a scanner, unless the file is in the same folder as the program, copy and paste the shortcut in memory from your files.
Need to import and declare PrintWriter
Give a name to the file which will be written to
REMEMBER TO CLOSE YOUR PRINTWRITER, or else your output to the file will NOT SAVE.
You do not need to close your FileWriter, this will happen when you close the PrintWriter which it is contained inside of.
Will need a FileWriter and a PrintWriter
Use the PrintWriter as a "shell for the FileWriter"
When declaring both, remember to write ", true"
Saying "true" effectively tells the program that the named file is Appendable.
In other words, declare the file writer AND the file which it will append to, inside of the printWriters declaration brackets.