Understanding Static or Class Variable in Java || Lesson 45 || Java Programming ||

Publicado em: 11 Julho 2023
no canal de: Wisdomers - Computer Science and Engineering
186
5

Understanding Static or Class Variable in Java
In this class, We discuss Understanding Static or Class variables in Java.
The reader should have prior knowledge of class and instance variables. Click here.
We take an example and understand static variables in Java.
Example:
The below diagram shows the example code.
The above code contains static variable p.
The memory is allocated to static variables during compile time.
Whenever the class loads to RAM, the static variables are assigned memory in the heap.
In the above example, we had an instance variable.
Whenever we create an object, memory is assigned, for instance, variables.
In our example, we created two objects, each with its own instance variables space.
A static variable is common to all the objects.
Any object can access and modify static variables.
The static variable is global to all the objects of the class.

Link for playlists:
   / @wisdomerscse  


Link for our website: https://learningmonkey.in

Follow us on Facebook @   / learningmonkey  

Follow us on Instagram @   / learningmonkey1  

Follow us on Twitter @   / _learningmonkey  

Mail us @ learningmonkey01@gmail.com


Nesta página do site você pode assistir ao vídeo on-line Understanding Static or Class Variable in Java || Lesson 45 || Java Programming || duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Wisdomers - Computer Science and Engineering 11 Julho 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 186 vezes e gostou 5 espectadores. Boa visualização!