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 Kotlin
About attr_accessor
About Java static and non-static methods
About Hinemos
static variable
About params
Java static
About Rails 6
About form_for
About Spring ③
About enum
About Optional
About hashes
About JitPack
About Dockerfile
About this ()
About devise
About encapsulation
About JAVA_HOME
About active_hash
About exceptions
static modifier
About scope
[Maven] About Maven
Review about bundler
About Java interface
[Java] About Java 12 features
About Rails routing
About cyclomatic complexity
About exception handling
About AsyncTask Generics
Java static story
About Ruby symbols
About HotSpot VM
About ruby ​​form
Static uncle's counterattack
[Swift] About generics
About Active Storage
About class inheritance.
About Ruby Hashes
About singular methods
About build tools
About MacinCloud introduction
[Note] About nil
About keyword arguments
[About double hash]
About installing Cocoapods
Something about java
Where about java
About HttpServlet () methods
About Java features
About ActiveRecord :: PendingMigrationError
About SIGNING_REGION: NoSuchFieldError
About the method
About spring AOP
About Ruby arrays
About Ruby inheritance
About Java threads