Java tutorial JVM memory space three areas (method area, heap area, stack area) method examples

The previous summary: JVM memory space is divided into three blocks, namely method area, heap area, and stack area

The method area contains: class files, static variables

The heap area contains: objects, instance variables in objects

The stack area contains: methods, local variables in methods

The method area first has data. The garbage collector focuses on the heap area (when there is no reference to it), the stack area is the most active, how to set the memory space and its application, and some technical points of the method, stack area, and heap area. Master these Skills, as well as strengthening the knowledge of various java technologies, I will analyze it for everyone.

Encapsulation: The main purpose is to simplify complex problems and encapsulate complex structures, leaving only simple operation entrances

Second, safety and portability

Realization: Property privatization, and set and get methods are provided, and security control can be performed in set.

===================================================================================

day10-class notes

1. This keyword

[Customer] Insert picture description here
[Understanding: Since the object is not unique and dynamic, the instance method does not need the static keyword] Insert picture description here
[This above can be omitted (in most cases)]

[CustomerTest] Insert picture description here
[this cannot be used in a method with static, combined with the above 4 rules totaling 6] Insert picture description here
[How to access instance variables in Static? Create an object! Insert picture description here
【In the class body directly define the instance variable, between the main method and the method body is the member variable, and define the local variable in the method body, to be determined】Insert picture description here
【ThisTest】Insert picture description here
Insert picture description here
【this final conclusion】Insert picture description here
【this cannot be omitted Circumstances] Insert picture description here
Insert picture description here
Insert picture description here
[Generate a parameter-free construction method] Insert picture description here
[Choose parameters in the pop-up window] Insert picture description here
Insert picture description here
[this is used in a parameter-free construction method to call a parameter-based construction method] Insert picture description here
Insert picture description here
[Where can this be used]

[Homework] Insert picture description here
Insert picture description here
Insert picture description here
[Put the last part above to the top, as follows] Insert picture description here
Learn Java with zero foundation, I recommend joining my ten-year Java learning field .

Guess you like

Origin blog.csdn.net/weixin_49794051/article/details/112279078