【Java static】
I didn't understand Java static very well, so I researched and summarized it. I would be grateful if you could point out.
I will add it as needed and use it as a memorandum.
This method does not change its processing even if it is called from any instance of a certain class. Static methods are not affected by instantiation.
It can be called without an instance in the form of class name.method name. Java's main method always needs static (because it's the first).
Variables that do not use static cannot be used unless the class is instantiated. → Non-static variable
・ Class variables Global variables in the class → Shared by all instances (created from classes).
-Instance variables Instance-specific local variables → Used only in one instance.
Recommended Posts