answersLogoWhite

0


Best Answer

Class Variables or Instances variables are variables that are declared inside a class and are available for the whole class. They are available for all instances of that class and are not specific to any method. Ex: public class Test { private String name = "Rocky"; } Here name is a class variable.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

static variable

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is class variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is a transient variable?

Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the val ue of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null


Which is the default variable storage class type in a function?

Everything is an object, and "typed" based on assignation. Your variable will be given a class when you declare it to be something, and the class will depend on what value you give the variable. It is always an object though, and its class may change if you change its value.


Is an abstract class cannot have any member variable in C plus plus?

An abstract base class may have member variables. Whether or not it actually needs member variables depends on the nature of the base class itself. If the variable is common to all derived classes, then it makes sense to place the variable in the base class. If some derived classes have no need of the variable, then it is better to derive an intermediate class with the variable, and to derive those classes that require that variable from the intermediate class, rather than directly from the abstract class.


What is static variable in the class for c plus plus?

Static member variables are local to the class. That is, there is only one instance of a static member variable, regardless of how many objects are instantiated from the class. As such, they must be declared inside the class, and defined outside of the class.


What is the by default storage class of any variable in c?

automatic storage class

Related questions

In oops what is the difference between class variable and variable?

Class Variable is a subset of Variables.


What is the static variable in the class in c?

A static member variable is local to the class rather than to an object of the class.


What is difference between struct variable and class object?

structure variable can access the variable but class object can access the function also


What is a transient variable?

Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the val ue of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null


Which is the default variable storage class type in a function?

Everything is an object, and "typed" based on assignation. Your variable will be given a class when you declare it to be something, and the class will depend on what value you give the variable. It is always an object though, and its class may change if you change its value.


Is an abstract class cannot have any member variable in C plus plus?

An abstract base class may have member variables. Whether or not it actually needs member variables depends on the nature of the base class itself. If the variable is common to all derived classes, then it makes sense to place the variable in the base class. If some derived classes have no need of the variable, then it is better to derive an intermediate class with the variable, and to derive those classes that require that variable from the intermediate class, rather than directly from the abstract class.


What is static variable in the class for c plus plus?

Static member variables are local to the class. That is, there is only one instance of a static member variable, regardless of how many objects are instantiated from the class. As such, they must be declared inside the class, and defined outside of the class.


Is class rank a qualitative or quantitative variable?

A qualitative variable is a variable that has categorized values and the difference cannot be measured. A quantitative variable is a variable that consist of ordinary values and the difference can be measured. Depending on the type of class rank it can be both qualitative as quantitative.


What is difference between an instance variable and a class variable?

An instance variable is typically associated with an object instance of the class whereas class variable is not associated with any object instance. Static variables are referred to as class variables while non-static regular variables are called instance variables. Simply put, you will have as many instances of the instance variable as there are object instances. i.e., if there are 10 instances of an object, you will have 10 instances of that instance variable as well. But, there will be only one instance of the static or class variable. Instance variables are accessed as follows: objname.variableName; Class variables are accessed as follows: ClassName.variableName;


What is importance of static variable?

The static modifier tells the system that this particular variable belongs to the class and does not belong to any specific instance of the same. The class will contain only one instance of the static variable irrespective of how many objects of the class you create.


What is the by default storage class of any variable in c?

automatic storage class


What is class register?

Register storage class is a compiler hint that the variable will be often used, and that it should generate code, if it can, to keep the variable's value in a register.