answersLogoWhite

0

It really depends on the programming language. In C and C++, all built-in types are initialised to zero when declared static, otherwise they are uninitialised. In Java, however, all data types are implemented as objects and are therefore initialised at the point of instantiation according to whichever constructor is invoked.

User Avatar

Wiki User

7y ago

What else can I help you with?

Continue Learning about Engineering

Which variable has been initialized?

To determine which variable has been initialized, you would need to look at the code or context in which variables are defined. An initialized variable is one that has been assigned a value at the time of its declaration. For example, in Python, a variable like x = 5 is initialized because it has been given a specific value. If you provide a specific code snippet or context, I can help identify the initialized variable.


What is Undefined in javascript?

In JavaScript undefined is a special value used when a variable has not had a value set to it, or has not been declared.


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.


What happens if you attempt to use a variable before it has been initialized?

In C, uninitialized variables may contain any value, usually whatever happened to be in the same memory location before the memory was allocated to that function. This is a likely source of bugs, since it means that whatever the programmer meant for the variable to contain was not in it.


What are the data types in java?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.

Related Questions

Which variable has been initialized?

To determine which variable has been initialized, you would need to look at the code or context in which variables are defined. An initialized variable is one that has been assigned a value at the time of its declaration. For example, in Python, a variable like x = 5 is initialized because it has been given a specific value. If you provide a specific code snippet or context, I can help identify the initialized variable.


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


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


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.


Write an expression that computes the sum of two variables in java?

int sum = a + b; PS: a and b are int variables that must have been already declared and initialized.


What are the differences of a constant and a variable?

A constant has only the exact value it's declared and can never be changed. A variable can have any number of values assigned. In programming, a variable can be given a value later in the code but can only be changed during runtime if its been declared as a pointer.


What is the current status of the keyword variable in the program?

The current status of the keyword variable in the program is dependent on its declaration and assignment within the code. If the variable has been declared and assigned a value, it is considered to be in use and holds that value until it is changed or the program ends. If the variable has not been declared or assigned a value, it is considered to be uninitialized and may cause errors if used in calculations or operations.


What is Undefined in javascript?

In JavaScript undefined is a special value used when a variable has not had a value set to it, or has not been declared.


When a flood is declared a National Disaster does flood insurance automatically pay if you are in a flood zone?

If you have flood insurance it will cover damage resulting from a flood. It does not matter if a national disaster has been declared or not.


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.


What happens if you attempt to use a variable before it has been initialized?

In C, uninitialized variables may contain any value, usually whatever happened to be in the same memory location before the memory was allocated to that function. This is a likely source of bugs, since it means that whatever the programmer meant for the variable to contain was not in it.


What is the kinds of variables?

There are two types of variables in Java:• Primitives - A primitive variable can be one of eight types: char, boolean, byte, short, int, long, double, or float. Once a primitive has been declared, its primitive type can never change, although in most cases its value can change.• Reference variables - A reference variable is used to refer to (or access) an object. A reference variable is declared to be of a specific type and that type can never be changed.