Karteikarten
Static Variables
Karten in diesem Stapel (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
Informationen
- Beschreibung
- Karteikarten am Static Variables, erstellt von BLU BLU am 23/01/2025.
- Erstellt von
- BLU BLU
- Aufrufe
- 0
- Bewertung