The method and variables marked as static when it belongs to a class rather than to any particular instance of the class. During development of the project when there is a
need to share a method or a variable between multiple objects of a class instead of creating separate copies for each object, we use static keyword to make a method or variable shared for all objects. In Java,
only the class is adequate to invoke a static method or access a static variable.Where a static variable is shared by all the instances of that class, means only one copy of the static variable is maintained.
Please log in or register to add a comment.