Parameter transfer
Objects communicate with each other by passing messages.The message is implemented as a method call that can activate a specific method on the object. Static Methods in Java can be activated by classes. The parameters in a method call provide an information exchange method between the caller object and the called object (not necessarily the caller object. The method call syntax can be any of the following: <object reference>. <Method Name> (<actual parameter list>) <Class Name>. <Static Method Name> (<actual parameter list>) <object reference> must be an expression that can calculate object references. If the caller and the called method are the same object, the <object reference> can be omitted. <Class Name> is the full name of a class. Multiple parameters in <actual parameter list> are separated by commas. Even if the real parameter list is empty, brackets must exist. This feature distinguishes a method call from a constructed block of an access field, a constructed block that points out the complete identifiers of a class, and a packet that uses a point-to-point operator. Objref. doit (time, place); int I = java. Lang. Math. Abs (-1); somemethod (ofvalue); the vertex operator (.) has a left combination. Real parameters are some parameters passed to the method when the method is activated. These parameters can change with the call. Parameters defined in the parameter method definition are local variables for the method. Real parameters and form parameters must meet the following requirements: · The number of real parameters must be equal to the number of form parameters in the method definition. · Each of the corresponding parameter-real parameters must be compatible. 1. For the metadata type, the data value of the real parameter is passed. 2. If the real parameter is a reference to an object (for example, a class instance or an array), it will pass the reference value rather than the object itself. 3. If the real parameter is an array element of a metadata type, it will pass the data value of the array element. 4. If the array element points to the object reference, it will pass the reference value of the array element.
Data Value of the Parameter |
Passed Value |
Metadata type |
Metadata Value |
Class type |
Reference Value |
Array type |
Reference Value |