> Method Declarations in java ~ Online tutorial

Method Declarations in java

Method Declarations
The diversity of physical arguments and opinions embraces all sorts of methods.
A method declares executable code that can be invoked, passing a fixed number of
values as arguments.

MethodDeclaration:
MethodHeader MethodBody
MethodHeader:
MethodModifiersopt TypeParametersopt
ResultType MethodDeclarator Throwsopt
ResultType:
Type
void
MethodDeclarator:
Identifier ( FormalParameterListopt )
  • The MethodModifiers are described in , the TypeParameters clause of a
    method in , the Throws clause in, and the MethodBody in .
  • A method declaration either specifies the type of value that the method returns oruses the keyword void to indicate that the method does not return a value.
  • The Identifiers in a MethodDeclarator may be used in a name to refer to the
    method.
  • A class can declare a method with the same name as the class or a field,
    member class or member interface of the class, but this is discouraged as a matter
    of syle.

MethodDeclarator:
MethodDeclarator [ ]
but should not be used in new code.
It is a compile-time error for the body of a class to declare as members two
methods with override-equivalent signatures (§8.4.2) (name, number of parameters,
and types of any parameters). Methods and fields may have the same name,
since they are used in different contexts and are disambiguated by different lookup
procedures .

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: