LEARNING STATIC MODIFIER IN JAVA

in OCD6 years ago

The static modifier in java directly relates to the class and not to the instance of the class. They are advantageous in the sense that you don't need to create an object each time to access the methods.

Screenshot_1.png

In the above code there's no any instance of the class named as MyClass to access the method which is firstMessage(). It's because whenever you used the static modifier, you don't need to create the instance of the object.

Sort:  

Nice tip for java learner. Gitplait platform is looking for people like you.
Your post has been curated with @gitplait community account because this is the kind of publications we like to see in our community.

Join our Community on Hive and Chat with us on Discord.

[Gitplait-Team]