Differentiate between static and non-static data members.
Views 17
Answer:
-
Static Data Members:
- Shared among all instances of a class.
- Only one copy exists for the entire class, regardless of the number of objects created.
- Accessed using the class name.
-
Non-static Data Members:
- Each object of the class has its own copy of non-static data members.
- They are also known as instance variables.
- Accessed through the object of the class.
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.