Home > Back-end >  Create an object in memory to do something?
Create an object in memory to do something?

Time:10-01

1: the Person at the location on the disk. The first class file is loaded into memory,
2: when performing the main method, has opened up the main method in the stack memory space (pressure - into the stack), and then in the main method of stack area allocated a variable p,
3: create an entity space in the heap memory, assigned a memory address values, new
4: in the entity space attribute space allocation, and the default initialization,
5: to show the initialization properties in space,
6: entity structure of a code block initialization,
7: call the entity corresponding constructor, constructor initializes, ()
8: will first address assigned to p, p variables refer to the entity, (pointing to the object)

CodePudding user response:

The description you also need to at least one premise, such as what the code is executed, the JVM will do processing,
Otherwise, your p variable is what, where p is the new, what's attributes, need what kind of initialization, and so on, these all have no, just so described is academic,
  • Related