Chapter 13
the newOutputStream( ) method
-is defined in the Files class -creates a file if it does not already exist -opens a file for writing
which of the following creates a Path named p to a FileStream named f Path p = new Path("C:\\Java\\MyFile.txt"); Path p = f("C:\\Java\\MyFile.txt"); Path p = f.getPath("C:\\Java\\MyFile.txt"); Path p = getPath(new f("C:\\Java\\MyFile.txt"));
Path p = f.getPath("C:\\Java\\MyFile.txt");
Java's print( ) and println( ) methods are defined in the _______ class
PrintStream
which of the following does the same thing as the BufferedWriter class newLine( ) method System.getProperty("line.separator") Path.getProperty("line.separator") System.out.println( ) System.out.print("\n")
System.getProperty("line.separator")
a path that needs no additional information to locate a file
absolute path
InputStream is:
an abstract class
the data hierarchy occurs in the following order from the smallest to largest piece of data
character, field, record, file
a collection of data stored on a nonvolatile device in a computer system
file
which of the following statements always returns the same value as Files.exists(file) file.checkAccess( ) file.checkAccess(EXISTS) file.checkAccess(READ,WRITE) file.checkAccess(file.exists( ))
file.checkAccess( )
buffer
holds bytes that are scheduled for input or output
you cannot delete a Path:
if it represents a directory that is not empty
a complete list of the disk drive plus the hierarchy of directories in which a file resides is its
path
which of the following systems is most likely to use batch processing an airline reservation system payroll point-of-sale credit checking an e-mail application
payroll
real-time applications use ________
random access files
a file channel is
seekable
when records are accessed one after the other in the order in which they were stored, the file is being used as a _______ access file
sequential
which of the following is true of streams streams are channels through which bytes flow streams always flow in two directions only one stream can be open in a program at a time
streams are channels through which bytes flow
the Path class getFileName( ) method returns
the last item in a Path's list of name elements
which of the following statements is true volatile storage lasts only a few seconds volatile storage is lost when a computer loses power computer disks are volatile storage devices
volatile storage is lost when a computer loses power
if you fail to close an input file:
you might lose access to the written data