File Input and Output (Midterms)

Cards (198)

  • Types of Storage Device
    Volatile Storage and Non-volatile Storage
  • Difference between volatile and non-volatile storage
    volatile is temporary
    non-volatile is permanent
  • Volatile values (stored in variables)

    are lost when the computer loses its power.
  • The _________ is being used when a Java program stores a value in a variable.
    Random Access Memory (RAM)
  • A ________ that is saved on a disk uses a non-volatile storage
    Java program
  • A java program that is saved on a disk uses a _____
    non-volatile storage
  • is a collection of data stored on a non-volatile device
    Computer file
  • computer file is a collection of data stored on a _____
    non-volatile device.
  • Categories of file:
    text file
    binary file
  • consists of data that can be read in a text editor
    text file
  • Data in a ______ is encoded using a scheme.
    text file
  • Data in a text file is encoded using a _____
    scheme
  • Most common schemes in text file
    ASCII
    Unicode
  • program files and application files are examples under
    text file
  • example of text file
    program files and application files.
  • Data that is not encoded as text
    binary file
  • contents that cannot be understood by viewing them in a text editor
    binary file
  • examples of ____ is images, music, and the .class extension files
    binary file
  • examples of binary of file
    images
    music
    .class extension files
  • Common characteristics of text and binary files
    size
    name
    date and time of creation.
  • where does the permanent files stored?

    main and root directory
  • folder and directories are used to organize _____
    stored files
  • are used to organize stored files
    folder and directories
  • what is in the path?

    complete list of the disk drive
    the hierarchy of directories in which the file is located
  • the complete list of the disk driveand the hierarchy of directories in which the file is located is located at is called
    path
  • example of complete path:
    : C:\Java\Chapter8\example.txt
  • symbol of path delimiter
    \
  • the special character used to separate path components.
    path delimiter or backslash\
  • What is a Path Class?
    creates objects that contain information about files and directories (such as sizes, locations, creation dates)
    used to check whether a file or directory exists.
  • creates objects that contain information about files and directories, such as sizes, locations, creation dates
    path class
  • used to check whether a file or directory exists.
    path class
  • used to check whether a file or directory exists.
    path class
  • examples of information about files and directories
    sizes, locations, creation dates
  • performs operations on files and directories
    File class
  • examples of operation on files and directories
    determining their attributes
    creating input and output streams
    deleting them.
  • performs operations on files and directories, such as determining their attributes, creating input and output streams, and deleting them.
    file class
  • how to use both file and path class?
    import java.nio.file.*;
  • To create and define a Path, use the Paths class and its get() method. Example: 

    Path filePath = Paths.get(“C:\\Java\\Chapter8\\sample.txt”);
  • a complete path

    absolute path
  • what is absolute path

    a complete path