answersLogoWhite

0

It depends what you mean by too many. If you mean "more than is required" then yes, it is more expensive since you're not using all of them for the purpose intended. But if you do need them all, regardless of how many there are, then the cost is moot.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

Are static variables serialized in java?

No, static variables are not serialized.


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.


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.


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


How can we optimize performance by reducing static in our codebase?

To optimize performance by reducing static in our codebase, we can minimize the use of global variables and functions, utilize local variables and functions instead, and employ techniques such as encapsulation and modularization to limit the scope of static elements. This can help improve code readability, maintainability, and efficiency.


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.


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.


Can non static methods can access static variables?

Yes, they can


Is it possible to write in static variables in main method in java?

Short answer: No. Only class member variables may be declared static. Local variables with a static declaration will throw an error (usually "illegal start of expression").


Are static variable created by giving keyword static in java?

yes bcoz static variables


Where the static variables are stored?

initialize static variables are stored in data segment where uninitialized static variables are stored in BSS(block storing for Symbol) it also a part of data segment exp static int i=10;//stored in data segment static int i;//stored in BSS (uninitialized data segment) Thanks NAvin


How you declare class scoped variables and member functions?

To scope class members to the class (rather than to instances of the class), declare them as static members of the class. Static members are accessible even when no instances of the class exist. As such, static member functions do not have access to a 'this' pointer, unlike ordinary (nonstatic) member functions.