方法中不属于签名或正文的部分的名称是什么
What is the name for the part of a method which is not part of the signature or body
正如我们在java中所知道的,方法签名仅包含方法名称及其参数。它不包括修饰符和 return 类型,也不包括此方法抛出的异常。到此为止就好了。
所以我的疑问是:
Name of method + parameters
--> 称为 **method signature**
然后
modifier + return type + name of method + parameters + throwing exception
--> 称为 ????
我希望我让你们理解了我的问题。
根据Java语言规范,你所指的是
MethodModifier
+ MethodHeader
.
来自规范 (§8.4 Method Declarations):
MethodDeclaration:
{MethodModifier} MethodHeader MethodBody
MethodHeader:
Result MethodDeclarator [Throws]
TypeParameters {Annotation} Result MethodDeclarator [Throws]
MethodDeclarator:
Identifier ( [FormalParameterList] ) [Dims]
modifier + return type + name of method + parameters + throwing exception{
//body
}
以上语法整体称为方法定义,您询问的部分称为Method-Headers。
->例如
public static int methodName(int a, int b) throws Exception
是一个调用的Method-Header
和
public static int minFunction(int n1, int n2) {
int min;
if (n1 > n2)
min = n2;
else
min = n1;
return min;
}
这个整体称为方法体。
.
正如我们在java中所知道的,方法签名仅包含方法名称及其参数。它不包括修饰符和 return 类型,也不包括此方法抛出的异常。到此为止就好了。
所以我的疑问是:
Name of method + parameters
--> 称为 **method signature**
然后
modifier + return type + name of method + parameters + throwing exception
--> 称为 ????
我希望我让你们理解了我的问题。
根据Java语言规范,你所指的是
MethodModifier
+ MethodHeader
.
来自规范 (§8.4 Method Declarations):
MethodDeclaration:
{MethodModifier} MethodHeader MethodBodyMethodHeader:
Result MethodDeclarator [Throws]
TypeParameters {Annotation} Result MethodDeclarator [Throws]MethodDeclarator:
Identifier ( [FormalParameterList] ) [Dims]
modifier + return type + name of method + parameters + throwing exception{
//body
}
以上语法整体称为方法定义,您询问的部分称为Method-Headers。
->例如
public static int methodName(int a, int b) throws Exception
是一个调用的Method-Header
和
public static int minFunction(int n1, int n2) {
int min;
if (n1 > n2)
min = n2;
else
min = n1;
return min;
}
这个整体称为方法体。
.