answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What happens if you don't initialize an instance variable of any of the primitive type in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is variable in c plus plus programming?

You declare a variable by first defining its data type and then its name followed by a semi-colon. Here is an example: int variable; The example above declares an uninitialized integer variable. You can initialize the variable by giving it a value such as "int variable = 1;". It is important to initialize your variables, because you can get errors when executing your program that the variable does not have a value or is uninitialized. Variables that are uninitialized have whatever garbage value happens to be when the program is executed. Here are all of the data types that a variable can be: *int - integer value *char - character value *bool - boolean value


What value is stored in an uninitialised variable?

The value of an uninitialised variable will be whatever value happens to reside in the allocated memory when that variable is instantiated. Attempting to access that value will result in undefined behaviour. There advantages to uninitialised variables. For instance, when allocating a large amount of memory prior to a memory copy, there's no point in initialising the memory since it will be initialised by the copy operation. In object-oriented programming, uninitialised variables do not exist. All variables are initialised at the point of instantiation via the object's class constructor. However, if the language also supports primitive data types (as C++ does), then those types will generally be uninitialised since primitives have no constructors.


What happens when you add primitive data type into a collection in java?

how do you get the value of the parameter in the applet


How to convert a string into an integer in javascript?

In C# you can do that in the following way Convert.ToInt32(yourStringHere), for instance Convert.ToInt32("wikianswers"). But not all string can be converted to int type. If it happens compilator will throw the exception converting error which you can handle using structure try { ...//your code } catch (Exception) { ... //your code in the case of the exception }


What is responding valuable?

Do you mean "responding variable"? In a scientific investigation, you try to change only one thing to see what happens. The thing you change is the manipulated variable (also called the independent variable). The result of this change is the responding variable (also called the dependent variable). For example, what if you measure the temperature of a beaker of water, then put it in the refrigerator for 24 hours, then measure again. The change in the temperature from the room to the fridge is the manipulated variable (you controlled it). Any change in the water temperature is the responding variable. It responded to the change you made.

Related questions

What is variable in c plus plus programming?

You declare a variable by first defining its data type and then its name followed by a semi-colon. Here is an example: int variable; The example above declares an uninitialized integer variable. You can initialize the variable by giving it a value such as "int variable = 1;". It is important to initialize your variables, because you can get errors when executing your program that the variable does not have a value or is uninitialized. Variables that are uninitialized have whatever garbage value happens to be when the program is executed. Here are all of the data types that a variable can be: *int - integer value *char - character value *bool - boolean value


What is the variable on the y-axis that happens because of another variable?

The dependent variable.


What is the difference of a dependent variable and an independent variable?

An independent variable is when you do not control what happens In an experiment,however; a dependent variable is when you actually control the experiment,


What is the difference of independent variable and a dependent variable?

An independent variable is when you do not control what happens In an experiment,however; a dependent variable is when you actually control the experiment,


What value is stored in an uninitialised variable?

The value of an uninitialised variable will be whatever value happens to reside in the allocated memory when that variable is instantiated. Attempting to access that value will result in undefined behaviour. There advantages to uninitialised variables. For instance, when allocating a large amount of memory prior to a memory copy, there's no point in initialising the memory since it will be initialised by the copy operation. In object-oriented programming, uninitialised variables do not exist. All variables are initialised at the point of instantiation via the object's class constructor. However, if the language also supports primitive data types (as C++ does), then those types will generally be uninitialised since primitives have no constructors.


Why is it important to have a control in a science experiment?

In order to be certain that the changing of the independent variable directly affects the dependent variable, a control must be taken where the independent variable is not changed-this ensures that whatever happens to the dependent variable happens because of the independent variable, and is not something that would happen anyway.


What are java variables?

It is something that holds a value. ex: string holds text. char holds one character. integer holds numbers. etc They can be declared by... string myWords = "Hello, World!"; System.out.println(myWords); This code will make a console say whatever is inside of that variable, which happens to be: "Hello, World!".


Can you solve for a variable in an equation?

Sure. You can always 'solve for' a variable, and if it happens to be the only variable in the equation, than that's how you solve the equation.


Distinguish between an independent variable and a dependent variable?

The independent variable is the value being manipulated or changed, while the dependent variable is the observed result of the independent variable being manipulated. "IF" you change the independent variable, "THEN" what happens to the dependent variable?


What happens when you add primitive data type into a collection in java?

how do you get the value of the parameter in the applet


What is the factor or change that happens in an experiment?

dependent variable


How one variable affects another happens in.... what?

experiments