Advanced Classes & Objects Flashcards

1
Q

What is method overloading?

A

Method overloading occurs when multiple methods in the same class have the same name but different parameter lists. (number or type)

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

What is method overriding?

A

Method overriding occurs when a subclass provides a specific implementation of a method that is already defined in its super class.

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

What is the ‘super’ keyword used for?

A

It refers to the super class of the current object. It can be used to call the superclass constructor, or to access superclass methods or fields.

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

What is encapsulation?

A

Encapsulation is the concept of hiding the internal details of an object and exposing only necessary functionality. (Uses private & public)

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

What is the difference between ‘private’, ‘protected’, and ‘public’ access modifiers?

A

private: accessible only within the same class.
protected: accessible within the same package or by subclasses.
public: accessible from any class.

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