OOP Midterms Flashcards
Can be inherited but not instantiated
Abstract Class
method only for abstract class, methods that don’t require implementation for its declaration.
Abstract Method
All subclass should implement the abstract method
Method Signature
If class is abstract have abstract method
Realization
Cant be inherited but can instantiate
Final Class
Cannot be override by connected classes
Final method
Classes that implement an interface inherits only method signature
Interface Inheritance
Key word used for implementing interface
“implements”
Constant and prevents the reference from changing, vallue can be changed but not the size
Final Variable
Object that groups multiple elements into a single unit
Java Collections
Collection framework 3 elements
Interface
Implementations
Algorithms
It is how you handle the collections
Interfaces
The classes that actually hold the data
Implementations
Useful routines
Algorithms
Enforce type on the collection
Generics
- stores elements in order added
- similar to array but growable
- allows to get and set using index
- fast in getting and setting elements
- slow in inserting and removing elements
List Collection
- no duplicate
- maintain its order
Set collection
Not sorted set
Hashset
Sorted set
Treeset
An object that map keys to values
Map Collection
Not sorted map collection
Hashmap
Sorted Map collection
Treemap
was used to provide generic iteration for collection implementations
iterator
How to determine class of an object
getClass()
a nested class and it doesn’t need the reference of the outer class.
Static class
there is only one copy of the variable in memory, regardless of how many instances of the class are created.
Static Variables
used to check whether an object is an instance of a particular class or implements a particular interface.
InstanceOf
allocates a memory location for the object and returns reference of the memory location
New Operator
a number pointing to a memory location
Reference
parameter passing
- pass-by-value
- pass-by-reference
garbage collection
an object loses a reference when:
- reference goes out of scope
- reference is pointed to another object
- reference is pointed to null
belongs to the class as a whole, not to a certain class
Static Members
use keyword: (static)