COMPROG

Cards (47)

  • Volatile storage is temporary. Volatile values (stored in variables) are lost when the computer loses its power.
  • Non-volatile storage is permanent. A Java program that is saved on a disk uses a non-volatile storage.
  • RAM stands for Random Access Memory
  • a text file consists of data that can be read in a text editor
  • a binary file contains data that is not encoded as text
  • permanent files are stored in main directory or root directory
  • directories in which files are located are called path
  • (\) path delimiter is special character used to seperate used to seperate path components
  • path class creates objects that contain information about files and directories, such as sizes, locations, creation dates, and is used to check whether a file or directory exists.
  • files class performs operations on files and directories, such as determining their attributes, creating input and output streams, and deleting them.
  • to use both path and file classes, add the following statement. import java.nio.file.*;
  • to create and define a path. Path filePath = Paths.get("asdasd\\asda\\asdasd");
  • absolute path is a complete path; does not need any information
  • relative path depends on other information
  • String toString() Returns the String representation of the Path, eliminating double backslashes
  • Path getFileName() Returns the file or directory denoted by this Path; this is the last item
    in the sequence of name elements.
  • int getNameCount() Returns the number of name elements in the Path
  • PathgetName() Returns the name in the position of the Path specified by the integer parameter
  • convert relative path to absolute path. toAbsolutePath()
  • delete() method of the Files class accepts a Path parameter and removes the last element
  • To retrieve useful information about a file, the readAttributes() method of the Files class is used.
  • A character can be any letter, number, or other special symbol (such as punctuation mark) that makes up data.
  • field is a group of characters that has some meaning.
  • record is a collection of fields that contain data about an entity
  • file consists of related records
  • readAttributes method takes 2 arguments
  • A stream is a flow of data.
  • · Flushing clears any bytes that have been sent to a buffer for output but have not yet been displayed on a hardware device.
  • An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.
  • Exception handling is the process used to change the normal flow of code execution if a specified exception occurs.
  • Exceptions that occur during compilation are called checked exceptions
  • Unchecked exceptions are exceptions that occur during execution.
  • ClassNotFoundException
    The class is not found.
  • IllegalAccessException
    Access to a class is denied.
  • InstantiationException
    Attempt to create an object of an abstract class or an interface.
  • NoSuchMethodException
    A requested method does not exist.
  • ArrayIndexOutOfBoundsException
    Accessing an invalid index of the array
  • ArithmeticException
    Arithmetic errorsuch as an integer divided by 0
  • NumberFormatException
    Invalid conversion of a string to a numeric format
  • ·A try block is a block of code that might throw an exception that can be handled by a matching catch
    block.