Key Concepts in Object-Oriented Programming

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

21 Terms

1
New cards

inheritance

A mechanism that allows reusing attributes and methods of one class in another, creating an 'is-a' relationship.

2
New cards

encapsulation

Bundling of data and methods that operate on that data within a class, hiding internal implementation details.

3
New cards

polymorphism

The ability of an object to take on many forms. Achieved through method overloading and overriding.

4
New cards

protected access modifier

Grants visibility to the defining class, subclasses, and other classes within the same package.

5
New cards

method overriding

A subclass provides its own implementation of a method already defined in its superclass.

6
New cards

super keyword

Used to call a method or constructor of the superclass.

7
New cards

Are constructors inherited by subclasses?

No, constructors are not inherited by subclasses.

8
New cards

What is the purpose of a constructor?

A constructor is a special method that initializes a newly created object of a class.

9
New cards

abstract class

A class that cannot be instantiated and may contain abstract methods (methods without implementation).

10
New cards

upcasting

Casting an object to a parent or more general type.

11
New cards

downcasting

Casting an object to a derived or more specialized type.

12
New cards

instanceof operator

Checks if an object belongs to or is derived from a specified class.

13
New cards

Object class

Every class implicitly extends the Object class.

14
New cards

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.

15
New cards

toString() method

Returns a string representation of an object. Overriding it provides a more useful description than the default.

16
New cards

interface

A collection of abstract methods and static constants that defines a contract for classes to implement.

17
New cards

class and interface relationship

A class implements an interface, providing concrete implementations for the methods defined in the interface.

18
New cards

interface vs abstract class

An abstract class can have implemented methods and instance variables, while an interface contains only abstract methods and static constants.

19
New cards

Comparable interface

Defines a natural ordering between objects of a class, using the compareTo(Object o) method.

20
New cards

composition

A 'has-a' relationship where one class contains an object of another class.

21
New cards

diamond problem

A difficulty arising in multiple inheritance where ambiguities occur when a class inherits from two classes that have a common ancestor.