instance variables different from class variables :
Instance variables are variables that are created locally within a class to refer to an object of the class. class variable is which is created globally in a class and its accessible within all instance of that current class.
class variables are declared with keyword static and Instance variables are declared without static keyword.
Class variables can be accessed anywhere within that class while an instance variable can only be accessed within the particular object of the class.
As class variables are common to all objects of a class, changes made to these variables through one object will reflect in another. instance variables are own copied of each objects.we cant change in any object.
Class variables can be accessed using class name/object reference. Instance variables can be accessed only through the object reference.
Liked By
Write Answer
instance variables and class variables
Join MindStick Community
You have need login or register for voting of answers or question.
Ben Affleck
04-Feb-2019bear pu
26-Jan-2019Prakash nidhi Verma
20-Jul-2018instance variables different from class variables :
Instance variables are variables that are created locally within a class to refer to an object of the class. class variable is which is created globally in a class and its accessible within all instance of that current class.
class variables are declared with keyword static and Instance variables are declared without static keyword.
Class variables can be accessed anywhere within that class while an instance variable can only be accessed within the particular object of the class.
As class variables are common to all objects of a class, changes made to these variables through one object will reflect in another. instance variables are own copied of each objects.we cant change in any object.
Class variables can be accessed using class name/object reference. Instance variables can be accessed only through the object reference.