answersLogoWhite

0

It should be public

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

How do you access the static variable and static methods of a class?

In java we access static variables and static methods without creating objects. i.e.,we can access directly by using classname we can also access static variables and static methods by using objects which are created by using class where the static variables and static methods are available


It is perfectly legal to any instance variable inside of a static method?

No. You will get compilation errors. The complier will complain that you are trying to access non static variables from inside a static method. A static method can access only static variables.


Can non static methods can access static variables?

Yes, they can


Why static functions cannot use instant variables?

Static functions are tied to a class, not to a particular object. A static function can only access static variables because it has no knowledge of member variables.


Can a static method access instance variables?

Variables cannot access variables; only methods can access variables. Non-static methods (also known as instance methods) are local to an object of the class and therefore have access to a "this" reference (referring to the current instance of the class, the object upon which the method was invoked), but static variables are local to the class itself. These variables are shared by all objects of the class and are therefore accessible to non-static methods. Static variable are also accessible to static methods and are therefore accessible even when no objects of the class exist.


Why in line functions should not access static data?

It may access static data, but you have to know what 'static data' means: data, which is local to the current module (not shared with other modules), so if you use the function both from module 'A' and from module 'B', they will use different variables (with the same name).


Are static variables serialized in java?

No, static variables are not serialized.


Can variables be changed?

A static variable is one which is not stored on the stack but in the memory of the program. Static variables can be changed.


Who was the Frenchman who attributed to reviving the Olympic games?

Static methods may not access the instance variables of their class (or any other class for that matter), other that via some object reference, e.g. anObject.someField. Static methods may even access private instance variables in their class via some object reference.


Why memory is divided into initialized and uninitialized areas?

The program's data segment. This area of memory is allocated by the linker and is used to store the program's global variables, static variables, static arrays and constants. Constants are always initialised, as are static variables, but global variables and static arrays need not be initialised.


What is the difference between static and dynamic variables?

Static variables (should) remain the same e.g. temperature of a water bath, k constant of a particular spring. Dynamic variables change as the experiment progresses e.g. air temperature and pressure, amount of natural light.


What facility static gives in class?

Static variables or function provides global view to the application that is u can access a static variable with one or more than one objects of a single class without loosing i.e. reinitializing its value.