java - When is memory space allocated to a variable? -


When the variable is declared, the compiler allocates 4 bytes of memory:

  Int a;  

Or it allocates memory when the value is assigned:

  a = 5;  

When is the memory allocated? During the variable declaration or initialization,

This is allocated when it is allocated with the given structure.

This method for local variables in a method (with some warnings) when the method applies.

For a fixed variable this happens when the class is "started" (which happens after some time it is full and before it is used before).

For an example variable this happens when the example is formed.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -