Static members of class are used for storing the values that are the sameI am bit confused about static and instance variable which one to use in chich scenario and advantages, disadvantages, practical uses of each one.
for all instances of class.
In the below statement
out is a static member variable of the System class right. How are we able to call println method on satatic member variable of a system class.
Instance variables are alive till instance of the object xyz exists in the memory, that is the reason they are also called instance variables. Instance variablesshared and reused by all methods of the class, and even visible from externall classes also.
Static variables are alive after the instance object deleted(garbage collected) in the memory???. How instance variable life is different from static variable in this aspect.??
From novice to tech pro — start learning today.