answersLogoWhite

0

Which variable has been initialized

Updated: 12/6/2022
User Avatar

Wiki User

14y ago

Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Which variable has been initialized
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Local variable if not initialized contains what?

It contains data which left after previous usage of that area of the memory.


Why static variables are initialized to zero?

When a variable is declared, your computer assigns a section of memory to that variable. If the variable isn't initialized, there's no way of knowing what data is already stored in that section of memory, which can cause errors in your programs. In managed languages, such as C#, this is done automatically at declaration. Although it's still good practice to initialize variables yourself.


What happens if you don't initialize an instance variable of any of the primitive type in java?

Java by default initializes it to the default value for that primitive type. Thus an int will be initialized to 0(zero), a Boolean will be initialized to false.


Can static variables be changed?

No, a static variable means that there is only one copy of that variable, and it is shared by all members of the class, or by all callers of a function.A variable that is read-only would be marked as const or final (depending on language).


Static method can use only static variable why?

A static method is a method that is a class method and is not attached to the object of that class. So if we use a non static variable of the class, it would most probably not have been initialized because no object could have been created for the class. Hence it would throw a null pointer exception. To avoid such an ambiguity, there is a restriction that static methods can use only static variables. This is to ensure that class methods can access only class variables both of which would get initialized simultaneously.

Related questions

What do you mean by initialization in c plus plus?

Not initialized variable: int myInt; Initialized variable: int myInt = 10;


What variable is one that has been declared but has not been initialized or assigned a value?

Uninitialized Page 59 Programming Logic and Design by Tony Gladdis


What variable is one that has been declared but has not been initialized or assigned value?

Uninitialized Page 59 Programming Logic and Design by Tony Gladdis


Which variable is initialized once when program is compiled?

global and static


How can a PHP static be initialized?

PHP static can only be initialized using a literal or constant. You can not use an expression. You can initialize it to an integer but you may not to another variable.


Can you use variables in case clauses in the switch statement?

YES - If the variable i a constant (final variable that is already initialized) NO - If the variable is not constant and is assigned at run time.


When garbage value occur in c?

Garbage data in C, or in any programming language, occurs when a variable is read without having been initialized first.


If a variable is not initialized the value of that variable is likely to be?

It's almost impossible to predict, but the value will be some data left by OS when it was previously used.


Local variable if not initialized contains what?

It contains data which left after previous usage of that area of the memory.


What are the value and preference of global variable?

Global variables can have any value, in C they are aumaticatically initialized to zero.


Why static variables are initialized to zero?

When a variable is declared, your computer assigns a section of memory to that variable. If the variable isn't initialized, there's no way of knowing what data is already stored in that section of memory, which can cause errors in your programs. In managed languages, such as C#, this is done automatically at declaration. Although it's still good practice to initialize variables yourself.


What happens if you don't initialize an instance variable of any of the primitive type in java?

Java by default initializes it to the default value for that primitive type. Thus an int will be initialized to 0(zero), a Boolean will be initialized to false.