The 1.Java stack and the run-time stack are two different concepts: they have similarities: the roles played in processing method invocations are essentially the same, so, although stored differently, they store similar information for this process. The task of the Java interpreter is to convert the information bytecode in the. class file so that the runtime stack can take over the work of the Java stack, which is simply an abstract construct.
2. The state of each method, including the main () method, is described by the contents of all automatic variables, the parameters of the method, and the return address (indicating the location of the caller of the re-return). The data fields that contain all this information are in the run-time stack, called the activity record or the stack structure. As long as one of the methods is executing, the activity records that belong to him exist. This record is the private information pool for this method and is the necessary information warehouse to store the correct execution of the method and return the method call location. The lifetime of an activity record is usually very short because they are dynamically allocated when the method is entered, and are dynamically retracted when the method exits.
An activity record typically contains the following information:
The value of all parameters of the method, the first cell address;
Local (automatic) variables can exist elsewhere, and the activity records contain only their descriptors and pointers to their stored addresses;
return address;
a dynamic link;
The return value of a method of non-void type.
3. Recursion: Tail recursion, non-tail recursion, indirect recursion, nested recursion, excessive recursion (logical simplicity and readability are the basis of support for recursive use). The cost of recursion is that it takes longer to run and is relative to a non-recursive method, consumes more runtime stack space, and if the recursion level is too deep, the run causes the stack to overflow and the program ends abnormally, resulting in an unrecoverable error stackoverflowerror).
4. Backtracking
Java Edition-recursion