CLASSES
Method Modifiers
8.4.3
8.4.2 Method Signature
The
signature
of a method consists of the name of the method and the number and
types of formal parameters to the method. A class may not declare two methods
with the same signature, or a compile time error occurs. The example:
class Point implements Move {
int x, y;
abstract void move(int dx, int dy);
void move(int dx, int dy) { x += dx; y += dy; }
}
causes a compile time error because it declares two
move
methods with the same
signature. This is an error even though one of the declarations is
abstract
.
8.4.3 Method Modifiers
MethodModifiers:
MethodModifier
MethodModifiers MethodModifier
MethodModifier: one of
public protected private
abstract static final synchronized native
The access modifiers
public
,
protected
, and
private
are discussed in 6.6.
A compile time error occurs if the same modifier appears more than once in a
method declaration, or if a method declaration has more than one of the access
modifiers
public
,
protected
, and
private
. A compile time error occurs if a
method declaration that contains the keyword
abstract
also contains any one of
the keywords
private
,
static
,
final
,
native
, or
synchronized
.
If two or more method modifiers appear in a method declaration, it is custom
ary, though not required, that they appear in the order consistent with that shown
above in the production for
MethodModifier
.
8.4.3.1
abstract
Methods
An
abstract
method declaration introduces the method as a member, providing
its signature (name and number and type of parameters), return type, and
throws
clause (if any), but does not provide an implementation. The declaration of an
abstract
method
m
must appear within an
abstract
class (call it
A
); otherwise a
compile time error results. Every subclass of
A
that is not
abstract
must provide
an implementation for
m
, or a compile time error occurs. More precisely, for every
157
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved