0
Is it true that if we create variables inside static method is also become static ?
2 Antworten
+ 1
no. variables what declared inside static methods are local variables. but static methods cant use instance variables, only class and local ones.
+ 1
No, what you actually heard was
You can only use class static members inside a static method. This was meant to say you can't access non static members of a class inside a static function unless you are explicitly passing an object of the class to that static function.
And yeah if you declare any variable inside a static method, they are just local variable and don't become static unless you explicitly use the static keyword in their definition!