As we know in java, the method signature contains only method name and its parameters. It doesn't include modifiers and return type and not also exception that this method is throwing. Up to this its okay.
So my doubt is if:
Name of method + parameters
--> known as **method signature**
then
modifier + return type + name of method + parameters + throwing exception
--> known as ????
I hope I made you guys understood of my question.
答案 0 :(得分:4)
According to the Java Language Specification, what you are referring to is called the
MethodModifier
+ MethodHeader
.
From the specification (§8.4 Method Declarations):
MethodDeclaration:
{MethodModifier} MethodHeader MethodBodyMethodHeader:
Result MethodDeclarator [Throws]
TypeParameters {Annotation} Result MethodDeclarator [Throws]MethodDeclarator:
Identifier ( [FormalParameterList] ) [Dims]
答案 1 :(得分:0)
modifier + return type + name of method + parameters + throwing exception{
//body
}
The above syntax as whole is called the method definition and the part you have asked about is called Method-Headers .
->For example
public static int methodName(int a, int b) throws Exception
is a called Method-Header
And
public static int minFunction(int n1, int n2) {
int min;
if (n1 > n2)
min = n2;
else
min = n1;
return min;
}
This,as whole is called Method Body.
.