Home >Java >javaTutorial >How to use array as parameter of method in java
JVM brief introduction
Partial Storage of variables in memory:
The reference does not point to the object. Writing method:
This reference does not point to any object.
Can a reference point to multiple objects at the same time?
For this code, it can only point to one object and store the address of an object. In the end, only the address of the last object is saved.
The process of passing the array as a parameter of the method:
Solution and printing results:
before Two solutions:
fun2 Print result:
##Analysis example: What does the picture below represent represents the reference of array2, pointing to the object pointed to by the reference of array1. The following picture represents the meaning of the above example: Note: The quote points to the quote. This sentence is wrong. References can only point to objectsDoes the reference have to be on the stack? Not necessarily. Whether a variable is on the stack is determined by the nature of your variable. If it is a local variable, it must be on the stack. If not, for example, instance member variables are not necessarily on the stack.The above is the detailed content of How to use array as parameter of method in java. For more information, please follow other related articles on the PHP Chinese website!