KnowledgeBoat Logo
|

Computer Applications

Differentiate between static variable and instance variable.

Java Classes

30 Likes

Answer

Static VariableInstance Variable
Static Variables are declared using keyword 'static'.Instance Variables are declared without using keyword 'static'.
All objects of a class share the same copy of static variables.Each object of the class gets its own copy of instance variables.
Static Variables can be accessed using the class name or object.Instance Variables can be accessed only through an object of the class.

Answered By

16 Likes


Related Questions