What is importance of static variable

What is importance of static variable

Answer : Below are importance of static variable:

  • Instance variables declared as static are global variables
  • If objects of class are declared no copy of a static variable will be created
  • Instance variables declared as static are global variables
  • All instances of the class share the same static variable
  • static variable can be accessed without reference to any object another words it can be used by itself

Leave a Reply

Your email address will not be published. Required fields are marked *

I am not Robot *