Object Oriented Programming Concepts

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

flashcard set

Earn XP

Description and Tags

Flashcards reviewing key OOP principles, including classes, objects, inheritance, and polymorphism.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

30 Terms

1
New cards

What is the primary focus in Object-Oriented Programming (OOP)?

OOP considers data first before actions are designed.

2
New cards

What is information hiding

Data is hidden and cannot be accessed by external methods.

3
New cards

What is modularity

The source code for an object can be written and maintained independently of the source code for other objects.

4
New cards

What is a class in OOP?

A construct that is used to define a distinct new type and is made up of Attributes/fields (Properties) that are grouped together to describe the object and Methods (Behavior) that describe what the object can do.

5
New cards

What are the three sections of a class diagram?

Class name, Attributes, and Methods.

6
New cards

What is an object in OOP?

A dynamic instance of a class; a software bundle of related state and behavior.

7
New cards

Why is a constructor needed in a class?

To create and instantiate an object of a defined class.

8
New cards

What is a default constructor?

A constructor that does not have any parameters and is used to initialize the attributes with default values.

9
New cards

What are the 2 types of parametrised constructors

Partially parametrised and filling parametrised

10
New cards

How do you instantiate an object in Java?

By using the 'new' keyword and calling the constructor of the class.

11
New cards

What is encapsulation in OOP?

A way of organizing data and functionality into a single unit by concealing the way the object is implemented; restricts access to data except through specified methods.

12
New cards

What does the principle of information hiding entail?

Declaring all fields and auxiliary methods as private in the class and limiting access to the data through Accessors and Mutators.

13
New cards

What are access specifiers used for in OOP?

To identify access rights for the data and member functions of the class; examples include public, private, and protected.

14
New cards

What is the purpose of a destructor or garbage collector?

To free memory and deallocate resources when an object's lifecycle is over.

15
New cards

What is an accessor or getter method?

A method in the class that makes private variables available to the main application or other units, providing read access to the attribute.

16
New cards

What is a mutator or setter method?

Provides write access to the attribute from the objects or other classes.

17
New cards

What is the purpose of auxiliary methods in a class?

Assist with the functionality of the class (calculations or formatting)

18
New cards

What is the purpose of toString() method?

Returns a formatted display of the objects attributes.

19
New cards

What is method overloading?

Two or more methods in a single class that have the same name but different types/order/number of parameters.

20
New cards

What is inheritance in OOP?

The process of creating a new class from an existing class in which objects of the new class inherit the attributes and behaviors of the existing class.

21
New cards

What is a subclass?

A class that inherits from another class.

22
New cards

What keyword is used in Java to indicate inheritance?

extends

23
New cards

What is method overriding?

Implementing a method in a derived class with the same signature as the base class method, allowing you to change the functionality of the inherited method.

24
New cards

What is polymorphism?

The ability of an object to take on different forms depending upon the situation, allowing objects to be processed differently based on their data type or class.

25
New cards

What is Compile time polymorphism?

Also known as Static binding. It is achieved through method overloading.

26
New cards

What is Runtime polymorphism?

Also known as Dynamic or late binding. It is achieved by overriding a base class method.

27
New cards

What does the 'static' keyword mean?

Linked to memory management

28
New cards

What is a Static Methods?

A static method belongs to the class rather than the object of a class.

29
New cards

What is a Static Block?

Used to initialize the static data member. It is executed before the main method at the time of class loading.

30
New cards

What is a Static Nested Class?

A static class created inside a class in java.