About static

After loading, the class file is separated into the static part and the other parts, and each is saved in a different memory area. static.png

Members qualified with static are placed in the static area, and other definitions are placed in the metaspace area (native memory).

--When an instance is created, ** the instance area is secured in the heap area according to the class definition in the metaspace area ** -** Static fields can be used without instantiation ** --Write "class name.field name" to access static fields. Or create an instance and access it using that reference. --Static members can be used without an instance, while non-static members cannot be used without an instance. Therefore, ** static methods cannot access non-static members ** --Conversely, it is possible to access static members from non-static methods

References

Thorough capture Java SE11 Silver problem collection

Recommended Posts

About static
static
About =
About method.invoke
About Kotlin
About attr_accessor
About Hinemos
About inheritance
static variable
About Docker
Java static
About Rails 6
About Spring ③
About enum
About polymorphism
About Optional
About hashes
About JitPack
About this ()
About encapsulation
About JAVA_HOME
About exceptions
static modifier
About scope
[Maven] About Maven
About exception handling
About Java interface
[Java] About Java 12 features
About Rails routing
About cyclomatic complexity
About exception handling
Java static story
About Ruby symbols
About array multiplication
[Java] About arrays
Static uncle's counterattack
About class inheritance.
About Spring AOP
About Ruby Hashes
About singular methods
About build tools
Chew about API
Where about java
About HttpServlet () methods
About SIGNING_REGION: NoSuchFieldError
About the method
About standard classes
About spring AOP
About Ruby arrays
About Ruby inheritance
About Java threads
[Java] About interface
About private public
About ruby block
About Java class
About Java arrays
About Ruby Hashes
About setAttribute / getAttribute
[Output] About each
[Rails] About ActiveJob ,!
About expression expansion.