Add These Flashcards
(26 cards)
Error
Similar to an exception, except that an error generally represents an unrecoverable situation and should not be caught.
Exception
An object that defines an unusual or erroneous situation.
try-catch Statement
Identifies a block of statements that may throw an exception.
catch clause
Follows a try block and defines how a particular kind of exception is handled.
Also called an exception handler
exception handler
Follows a try block and defines how a particular kind of exception is handled.
Also called a catch clause.
finally clause
An optional end to a try-catch statement.
Defines a section of code that is executed no matter how the try block is exited.
exception propagation
If an exception is not caught and handled in the method where it occurs, control is immediately returned to the method that invoked the method that produced the exception. If it isn’t caught there, control returns to method that called it, and so on until it is passed out of the main method and then the program is terminated.
Errors
LinkageError
ThreadDeath
VirtualMachineError
AWTError
Exceptions
IllegalAccessException
NoSuchMethodException
ClassNotFoundException
RuntimeExceptions
ArithmeticException
IndexOutOfBoundsException
NullPointerException
checked exception
Must either be caught by a method or be listed in the throws clause of any method that may throw or propagate it.
throws clause
Appended to the header of a method definition to formally acknowledge that the method will throw or propagate a particular exception if it occurs.
unchecked exception
Requires no throws clause. The only unchecked exceptions in Java are objects of the type RuntimeException or any of its descendants: ArithmeticException IndexOutOfBoundsException NullPointerException
Abstraction
Hides certain data types at certain times.
Data Type
A group of values and the operations defined on those values.
ADT
Abstract Data Type: A data type whose values and operation are not inherently defined within a programming language.
It is abstract only in that the details of its implementation must be defined and should be hidden from the user.
data structure
The collection of programming constructs used to implement a collection.
API
Application Programming Interfaces: A set of classes that represent a few specific types of collections, implemented in various ways.
Stack
A linear collection whose elements are added to, and removed from, the same end.
Last in, first out
Stack: push
Adds an element to the top of the stack.
Stack: pop
Removes an element from the top of the stack.
Stack: peek
Examines the elements at the top of the stack.
Stack: isEmpty
Determines if the stack is empty.
Stack: size
Determines the # of elements on the stack