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

Pubblicato il: 11 luglio 2023
sul canale di: 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


In questa pagina del sito puoi guardare il video online Understanding Static or Class Variable in Java || Lesson 45 || Java Programming || della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Wisdomers - Computer Science and Engineering 11 luglio 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 186 volte e gli è piaciuto 5 spettatori. Buona visione!