chapter 13 Flashcards
what is getting stuff from a disk file to print onto a disk file in your computer, similar to?
it is the similar to writing on a keyboard to display onto the console screen
what is raw data and what is cooked data in a java program?
raw data is derived from your hard drive in your computer and cooked data is data that has been saved onto your hard drive.
what is possible with cooked data?
you can retrieve cooked data from your hard drive as raw data to be used in another program making it more convenient than rewriting old code from scratch
how do you insert code templates?
choose Window> preferences> resulting dialog box, choose Java> Editor> Templates
where should a rawData.txt file be located?
in the root of a project folder on your hard drive
how do you call to close when using a diskScanner in your program?
diskScanner.close()
what is the basic format for using diskScanner in your code?
Scanner diskScanner = new Scanner(new File(“file”));
String oneWord = diskScanner.next();
when using diskScanner in your program where is the scanner looking to find a file?
in the root of the program’s project folders
what is it called after the dot in a file name
in a file name, anything that you put after a dot is called a filename extension
what is a printStream?
similar to a scanner but instead it is used to output data in the console or file but a Scanner can read from files, strings, or the console.
what is the difference between “System.in” and the expression “new File(“rawData.txt”)” ?
“System.in” stands for the computer’s keyboard
&
the expression “new File(“rawData.txt”)” stands for a file on your computer’s hard drive
what is FileNotFoundException and when does this occur?
a FileNotFoundException is something that may go wrong during an attempt to read input from a disk file or an attempt to write output to a disk file.
how do you brace against problems with disk file access?
java insists on you adding some extra words to your code, FileNotFoundException forming a throws clause.
what is a throws clause ?
it’s a kind of disclaimer like a warning saying “I realize that this code can run into trouble”.
what happens if you do not put FileNotFoundException in your code when it comes to using code with disk access?
when it comes to disk access, if you do not put a throws clause like FileNotFoundException the java compiler refuses to compile your code.