Static variable in java | What is Static Variable in Java ?

preview_player
Показать описание
What is Static Variable in Java?
Static variable in Java is variable which belongs to the class and initialized only once at the start of the execution.

Java static variable

If you declare any variable as static, it is known as a static variable.

The static variable can be used to refer to the common property of all objects (which is not unique for each object), for example, the company name of employees, college name of students, etc.
The static variable gets memory only once in the class area at the time of class loading.

The static keyword in Java is used for memory management mainly. We can apply static keyword with variables, methods, blocks and nested classes. The static keyword belongs to the class than an instance of the class.

The static can be:

Variable (also known as a class variable)
Method (also known as a class method)

Stay tuned and watch the full video.
Don't forget to like, subscribe to our youtube channel. Press the bell icon🔔 so you never miss any update from the v2v class.
#v2v #Java #BscIT

►Click here to subscribe:-
Follow us On Social Media:-
Рекомендации по теме
Комментарии
Автор

Is there any difference in static variable and static method ?

nileshbhosale
Автор

brother code ka example deke explain kra kro vrna koi bhi nahi smjhe ga or mujhe bhi kuchh samajh nahi aaya

deepanshusaini
visit shbcf.ru