1/19
Flashcards on abstraction, abstract classes, and interfaces in Java.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Abstraction
A way of separating the implementation of an interface and one of a design motif of OOP such as encapsulation, Inheritance, Polymorphism, Class, and Object.
Abstraction in Java
Achieved by using interfaces or abstract classes.
Extend Keyword
Used for an abstract class to implement an abstract method with concrete behavior.
Implement Keyword
Used for an interface to implement an abstract method with concrete behavior.
Abstract Class Method Type
Both abstract and non-abstract
Interface Method Type
Abstract method
Abstract Class Method Implementation
Some methods are implemented, while some methods do not implemented but could be override
Interface Method Implementation
All methods are implemented
Abstract Class Inheritance
Single inheritance (A class can be inherit from a single class)
Interface Inheritance
Support multiple inheritance
Abstract Class Representation
An abstract class represents a type of object
Interface Representation
Interface represents a set of behaviors
Abstract Class Access Modifiers
Public, protected, and private are used in abstract class for their methods and properties
Interface Access Modifiers
Only public modifier with methods
Abstract Class Variables
Abstract class can have attributes
Interface Variables
Interface don’t have attributes
Feature of Abstract Class
It can not be instantiated
Feature of Interface
It support polymorphism and multi inheritance
Final Keyword
Immutable objects, it means once an object is created, it cannot be modified
The final keyword
Prevents child classes from overriding a method.