Static member VS Object Member explained by a self -taught developer

This is my very first article on Java, so cheer me!

Let get into it, Static member vs Object members ( AKA instance member ).

To get your head around first we must understand what mean “Static“ for an element in java .

1) Java static variable

If you declare any variable as static, it is known as a static variable.

- The static variable can be used to refer to the common property of all objects (which is not unique for each object), for example, the company name of employees, college name of students, etc.

- The static variable gets memory only once in the class area at the time of class loading.

— https://www.javatpoint.com/static-keyword-in-java

This little paragraph do give a first byte from the cake of this topic, so having an element as “Static” mean that it will remain the same in term memory reference all cross the instances that can be created using the parent class!

In the other hand the Object member is coupled to the instance or the object that is defined inside, in another term it won’t be shared with other instances of the same class.

The following example explain more, so let’s consider the following class ParentClass

This ParentClass has two properties staticCounter & memberCounter where the first one is defined as static.

Now let’s implement class that will consume the parent class:

The final output will look something like this: