WHAT IS THE DIFFERENCE BETWEEN AN INSTANCE VARIABLE AND A STATIC VARIABLE IN JAVA?

Sumit Kesarwani

Total Post:782

Points:3910
Posted by  Sumit Kesarwani
Java 
 1183  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    What is the difference between an instance variable and a static variable in java?

    Class variables are called static variables. There is only one occurrence of a class variable per JVM per class loader.When a class is loaded the class variables are initialized.

    Instance variables are non-static and there is one occurrence of an instance variable in each class instance.Also known as a member variable or a field.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!