OOP Flashcards

1
Q

What are constructors?

A

They are a special kind of method that plays the role of initializing objects?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Constructors vs methods

A

Constructors: Initialize and object’s state
Methods: Used to exhibit functionality of an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are their 3 peculiarities(constructors)

A
They have the same name as the class itself
They do not have a return type -- not even void
Invoked using the new operator when an object is created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Method overloading

A

Multiple methods can have the same name with different paramters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Instance vs Static class members

A

Static: Can be invoked directly from their class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Adv of OOP

A

Modularization
Encapsulation
Understandability
Maintenance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Public vs Private

A

Public: Access modifier visible to all classes in any package
Private: Access modifier visible only to declared class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Objects

A

An object is an entity in the real world. An object has:
A unique identity,
state(Also known as properties or attributes)
behaviour(Methods): What the object can do.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Classes

A
Objects of the same type are defined using a common class
A class is a template or blueprint that defines the properties and behaviours for objects.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does a class use

A

Variables to define the state
methods to define behaviors
Constructors to perform initializing actions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Access modifiers

A

Used for controlling levels of access class members in Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly