Fichas
Static Variables
Fichas del conjunto (6)
- 1How does a static variable works ?- Once declared, a single copy of the variable is created and shared amongst all objects
- essentially, global variables
- Can be accessed using class reference - 2Where is the reference variable placed memory wise?In Stack memory
- 3Where is the object saved memory wise?In Heap Memory
- 4Where is the static variable been saved and when does it loads?Static variable belongs to the class. Gets loaded in the class area when the class loads
- 5Static Methods- Belongs to the class rather than an object of a class
- Direct access using the class name
- Can access static data members only and can change their values - 6Static Blocks- Used to initialize static variables
- Gets executed exactly once, wehen the class is first loaded, thus they are executed before main method
- Can access static data members and can change their values
Información
- Descripción
- Fichas sobre Static Variables, creado por BLU BLU el 23/01/2025.
- Creado por
- BLU BLU
- Visitas
- 0
- Valoración