1. 程式人生 > >[Java] 方法簽名(method signature)

[Java] 方法簽名(method signature)

方法頭指定修飾符(例如static)、返回值型別、方法名、和形式引數。

方法頭中定義的變數稱為形參 (形式引數,formal parameter 或 parameter),形參如同佔位符。當方法被呼叫時,傳遞一個值給形參,此值稱為實參(實際引數, actual parameter 或 argument),形參列表指的是形參的型別、順序和形參的數目。

方法名和形參列表共同組成方法簽名

原文:
The method header specifies the modifiers, return value type, method name, and parameters of the method. The static modifier is used for all the methods in this chapter. The reason for using it will be discussed in Chapter 8, Objects and Classes.

The variables defined in the method header are known as formal parameters or simply parameters. A parameter is like a placeholder: when a method is invoked, you pass a value to the parameter. This value is referred to as an actual parameter or argument. The parameter list refers to the method’s (??????) type, order, and number of the parameters. The method name and the parameter list together constitute the method signature. Parameters are optional; that is, a method may contain no parameters. For example, the Math.random() method has no parameters

[1] Introduction to Java Programming 10th. 6.2 Defining a Method