COMPROG MIDTERM

Cards (85)

  • EXCEPTION
    is an event that occurs during the executionof 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.
  • CHECKED EXCEPTIONS
    Exceptions that occur during compilation
  • 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.
  • UNCHECKED EXCEPTION
    exceptions that occur during execution
  • ArithmeticException
    Arithmetic error, such as an integer divided by 0
  • ArrayIndexOutOfBoundsException

    Accessing an invalid index of the array
  • ArrayStoreException
    Assigning a value to an array index that does not match the expected data type
  • InputMismatchException
    Entering a value that does not match the expected data
    type
  • NullPointerException
    Invalid use of a null reference
  • NumberFormatException
    Invalid conversion of a string to a numeric format
  • StringIndexOutOfBoundsException
    Accessing an invalid index (character) of a string
  • TRY BLOCK
    is a block of code that might throw an exception that can be handled by a matching catch block.
  • CATCH BLOCK
    is a segment of code that can handle an exception that might be thrown by the try block that precedes it.
  • getMessage()
    method can be used to determine Java's message about the exception.
  • System.out.println(exceptionName.getMessage());
    syntax of using get message
  • FINALLY BLOCK
    contains statements which are executed whether or not an exception is thrown.
  • USER DEFINED EXCEPTION
    is created by extending the Exception class.
  • THROW STATEMENT
    sends an exception out of a block or a method so it can be handled elsewhere.
  • VOLATILE STORAGE
    it is the temporary storage
  • NON-VOLATILE STORAGE
    it is the permanent storage
  • COMPUTER FILE

    is a collection of data stored on a non-volatile device.
  • TEXT FILE

    consists of data that can be read in a text editor.
  • BINARY FILE

    contains data that is not encoded as text.
  • MAIN DIRECTORY OR ROOT DIRECTORY
    Permanent files are commonly stored in where
  • FOLDERS OR DIRECTORIES
    To organize stored files what is used
  • 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.
  • import java.nio.file.*;
    to use both PAth and Files class what statement would be followed
  • Path filePath = Paths.get("C:\\Java\\Chapter8\\sample.txt");

    Syntax to create and define a Path
  • ABSOLUTE PATH
    is a complete path; it does not require any other information to locate a file on a system.
  • RELATIVE PATH
    depends on other path 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
  • Path getName(int)
    Returns the name in the position of the Path specified by the integer parameter
  • toAbsolutePath()
    What method is used to convert the relative path to an absolute path