GoConqr has a new look! Let us know what you think.

Flashcards

Static Variables

BLU BLU German 6 cards

Cards in this deck (6)

  1. 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
  2. 2Where is the reference variable placed memory wise?In Stack memory
  3. 3Where is the object saved memory wise?In Heap Memory
  4. 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
  5. 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
  6. 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

Information

Description
Flashcards on Static Variables, created by BLU BLU on 23/01/2025.
Created by
BLU BLU
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?