Static - Day 4 Flashcards

1
Q

Static variable

A

Static variable belongs to an entire class not a specific object

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

What is happening with static variables?

A

Variable is created and shared among all objects at the class level.

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

Member variable

A

Variables consisting to the class so instance and static variables

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

Set up

A

private static datype varname;

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

Static methods

A

Can only access static variables.

Can be engoles without creating an instance of a class, setter and getter methods:

Public static float getDeliverycharge() {
Return deliveryCharge;
}

Public static void setDeliveryCharge(float deliveryCharge) {
Customer.deliveryCharge = deliveryCharge;
}

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

Statics work only with statics

A

Can’t call instance members directly!!

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