Add These Flashcards

0
Q

Error

A

Similar to an exception, except that an error generally represents an unrecoverable situation and should not be caught.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Exception

A

An object that defines an unusual or erroneous situation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

try-catch Statement

A

Identifies a block of statements that may throw an exception.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

catch clause

A

Follows a try block and defines how a particular kind of exception is handled.
Also called an exception handler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

exception handler

A

Follows a try block and defines how a particular kind of exception is handled.
Also called a catch clause.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

finally clause

A

An optional end to a try-catch statement.

Defines a section of code that is executed no matter how the try block is exited.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

exception propagation

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Errors

A

LinkageError
ThreadDeath
VirtualMachineError
AWTError

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Exceptions

A

IllegalAccessException
NoSuchMethodException
ClassNotFoundException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

RuntimeExceptions

A

ArithmeticException
IndexOutOfBoundsException
NullPointerException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

checked exception

A

Must either be caught by a method or be listed in the throws clause of any method that may throw or propagate it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

throws clause

A

Appended to the header of a method definition to formally acknowledge that the method will throw or propagate a particular exception if it occurs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

unchecked exception

A
Requires no throws clause.
The only unchecked exceptions in Java are objects of the type RuntimeException or any of its descendants:
ArithmeticException
IndexOutOfBoundsException
NullPointerException
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Abstraction

A

Hides certain data types at certain times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Data Type

A

A group of values and the operations defined on those values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

ADT

A

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.

16
Q

data structure

A

The collection of programming constructs used to implement a collection.

17
Q

API

A

Application Programming Interfaces: A set of classes that represent a few specific types of collections, implemented in various ways.

18
Q

Stack

A

A linear collection whose elements are added to, and removed from, the same end.
Last in, first out

19
Q

Stack: push

A

Adds an element to the top of the stack.

20
Q

Stack: pop

A

Removes an element from the top of the stack.

21
Q

Stack: peek

A

Examines the elements at the top of the stack.

22
Q

Stack: isEmpty

A

Determines if the stack is empty.

23
Q

Stack: size

A

Determines the # of elements on the stack

24
Q

Exception

A

An object that defines an unusual or erroneous situation.

25
Q

To expand an array size:

A

private void expandCapacity(){
stack = Arrays.copyOf (stack, stack.length * 2);
}