MidTerm Exam Flash Cards
What does the toString() method return?
It returns a String representation of the Object.
What does the equals(otherObject) do?
It is a method compares an Object to otherObject and returns true if both variables reference the same object
What is a try block?
Surrounds normal code, which is exited immediately if the block throws an exception
What is a catch block?
A catch block catches an exception thrown in a preceding try block
A catch block is also called…
An exception handler
What is a FileNotFoundException?
Attempt to open a file denoted by a filename failed
What is EOFException?
End of file or end of stream has been reached unexpectedly
What is an ArrayIndexOutOfBoundsExcepton?
An array has been accesed with an illegal index
What is an InputMismatchException?
Received input does not match expected type or the input is out of range for the expected type
What is an ArithmeticException?
Arithmetic condition failed
What does null mean?
null is a special value indicating a pointer points to nothing
What is the first node called?
Head
What is the last node called?
Tail
What does append() mean? Where is the element added?
Add a new element and the tail points to the new node
What is prepend()? Where is the element added?
Adds the new node before the list’s head
How to prepend to an empty list?
Check if the list’s pointer head is empty.
Point the head to the new node
How to prepend to a non-empty list?
Check if the head not null(not empty)
point the new node to the head node
Removing a node:
ListRemovesAfter(numsList, node 5).
What happens to the node?
The node that it points to is removed
What is removed?
ListRemoveAfter(numsList, null)
If the curNode is null, it removes the head node
True or False.
If the current node is null does it remove the head?
True.
Where does a search start?
At a lists head
What happens when no match is found?
Null is returned
When swapping 2 variables what other variable must you use?
A temp variable
When reversing a list what happens?
The outer most elements are swapped all the way until the middle