1/20
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
inheritance
A mechanism that allows reusing attributes and methods of one class in another, creating an 'is-a' relationship.
encapsulation
Bundling of data and methods that operate on that data within a class, hiding internal implementation details.
polymorphism
The ability of an object to take on many forms. Achieved through method overloading and overriding.
protected access modifier
Grants visibility to the defining class, subclasses, and other classes within the same package.
method overriding
A subclass provides its own implementation of a method already defined in its superclass.
super keyword
Used to call a method or constructor of the superclass.
Are constructors inherited by subclasses?
No, constructors are not inherited by subclasses.
What is the purpose of a constructor?
A constructor is a special method that initializes a newly created object of a class.
abstract class
A class that cannot be instantiated and may contain abstract methods (methods without implementation).
upcasting
Casting an object to a parent or more general type.
downcasting
Casting an object to a derived or more specialized type.
instanceof operator
Checks if an object belongs to or is derived from a specified class.
Object class
Every class implicitly extends the Object class.
equals(Object o) method
Used to compare two objects for equality. Can be overridden to define equality based on object attributes rather than just references.
toString() method
Returns a string representation of an object. Overriding it provides a more useful description than the default.
interface
A collection of abstract methods and static constants that defines a contract for classes to implement.
class and interface relationship
A class implements an interface, providing concrete implementations for the methods defined in the interface.
interface vs abstract class
An abstract class can have implemented methods and instance variables, while an interface contains only abstract methods and static constants.
Comparable interface
Defines a natural ordering between objects of a class, using the compareTo(Object o) method.
composition
A 'has-a' relationship where one class contains an object of another class.
diamond problem
A difficulty arising in multiple inheritance where ambiguities occur when a class inherits from two classes that have a common ancestor.