when we declare variable method in a class each object created on that class will separetly maintain its own data copy and that is why they are called as non static data members and they can be accessed compulsory by creating object only
On the other hand when we declare a data member as static it means there will be only one copy of that data members it is directly associated with the class but not the object in java and C# a variable method a property can be declared as static
*static variable
when we declare a variable as static then there will be only one copy of that variable it gets initialized only one time it maintains its values across all the instances of that class by passing the value from one object to another
Comments
Post a Comment