1/49
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Abstraction Definition
The ability to separate the interface from the implementation, hiding details and showing only what is necessary.
Abstraction (method example)
Putting code inside a method creates a new concept whose interface (name, inputs, outputs) is what matters.
Abstraction Levels
Methods → classes → packages represent increasing abstraction layers.
Abstraction Benefits
Higher readability, reusability, testability, maintainability, and simplification of complex systems.
Inheritance Definition
A two-way capability: (1) a child extends a parent (gains its features and adds more), and (2) common capabilities of children can be factored into a parent.
Inheritance is called an “__-_” relationship
Also called an “is-a relationship” in OOP.
Superclass
A more general class from which others inherit.
Subclass
A more specialized class that extends a superclass.
Default Parent in Java
Every class implicitly inherits from the Object class.
extends Keyword
Java keyword used to denote inheritance.
Inheritance Asymmetry
A manager is-an employee, but an employee is NOT necessarily a manager.
Method Overriding
Re-implementing an inherited method in the subclass.
Constructors and Inheritance
Constructors cannot be inherited or overridden because they are not class members.
UML Inheritance Connector
A solid line with a hollow triangle pointing to the superclass.
Visible Members That Are Inherited
All members visible according to access modifiers (public, protected, package).
super Keyword
Used to call superclass constructors and methods from a subclass.
Is Multiple Inheritance in Java supported?
Not supported for classes due to increased complexity.
What is a final Class?
A class that cannot be extended.
What is a final Method?
A method that cannot be overridden.
What is a final Attribute?
An attribute that cannot be changed after initialization.
Does Inheritance increase complexity?
Overusing inheritance increases complexity
Encapsulation Definition
Bundling attributes and behaviors in a class while controlling their visibility.
Encapsulation Abilities
Control access levels—read-only, write-only, read/write, or hidden.
Encapsulation Benefits
Organizes code, protects data, controls external access, prevents accidental misuse.
Is encapsulation just data hiding?
Encapsulation is NOT just hiding—it also includes bundling and controlled access.
Mutable Object
An object whose state can change
Interface (general meaning)
The set of visible members of a class (its API).
Java Interface
A separate construct containing abstract methods and optional default/static methods.
interface Keyword
Used to declare a Java interface.
implements Keyword
Used by a class to implement an interface.
Interface Requirements for inheriting class
A class must implement all interface methods or compilation fails.
Interface Naming
Interfaces should have abstract, generic names (e.g., AnimalInt vs DogInt).
Interface Default Methods
Methods in an interface with implementation (allowed since Java 8).
Are Interface Constants allowed?
Must be public static final (often implied automatically).
Are Interface Instance Variables allowed?
Not allowed—interfaces cannot have state.
Interface-Class Relationship
A class implementing an interface “is-an” instance of that interface.
Interface UML Connector
Dashed line with hollow triangle pointing to the interface.
Interfaces Extending Interfaces
An interface may extend multiple interfaces.
Association (UML)
A general relationship indicating dependency, aggregation, or composition.
Polymorphism
The ability to assign/pass a child object to a parent reference, enabling behavior to be chosen at runtime.
Runtime Binding
Java determines which overridden method to call at runtime based on the actual object.
Why Polymorphism Exists
Allows code to handle new types with minimal changes, solving Change and Complexity.
Method Overloading Definition
Same method name but different parameter lists in the same class.
Method Overloading Uses
Allows multiple versions of a behavior tailored to different input types.
Dependency Reduction via Polymorphism
Code depends on one interface instead of many classes.
What does (A-PIE) stand for?
Abstraction, Polymorphism, Inheritance, Encapsulation.
Abstraction (A-PIE summary)
Separating interface from implementation.
Polymorphism (A-PIE summary)
Passing a child object to a parent reference at runtime.
Inheritance (A-PIE summary)
Extending or factoring common behavior across classes.
Encapsulation (A-PIE summary)
Bundling data + behaviors and controlling their visibility.