Java - Part 251 - Different ways of accessing variables inside static methods

preview_player
Показать описание

In this session, I have explained and practically demonstrated the different ways of accessing variables inside static methods in Java programming.

- Accessing instance variables inside static methods by creating object for the Class in which instance variable is created
- Accessing static variables directly inside the static methods, as static methods can directly access the other static variables and methods
- Accessing instance variables created inside a class, into the static methods created inside other classes
- Accessing static variables created inside a class, into the methods created inside other classes
Рекомендации по теме
Комментарии
Автор

the famous indian dude who explain you how life work in 6 minutes. thanks dude !

latassedethe
Автор

sir can we access instance variable in this way, demo.a outside the ssystem.out.println() means outside.

veervikramsingh
Автор

Hello sir, Please help me, I want to declare instance variable, out side static method but I initialize this instance variable with in static method and in main method, I create an object and call the static method, how can I do?

abhisheksamantray
Автор

More what topics are left out in core java sir ?

rahulk