INTERFACES
Inheritance and Overriding
9.4.1
9.4   Abstract Method Declarations
AbstractMethodDeclaration:
AbstractMethodModifiers
opt
ResultType MethodDeclarator Throws
opt
 ;
AbstractMethodModifiers:
AbstractMethodModifier
AbstractMethodModifiers AbstractMethodModifier
AbstractMethodModifier: one of
public abstract
The access modifier
public
 is discussed in  6.6. A compile time error occurs if
the same modifier appears more than once in an abstract method declaration.
Every method declaration in the body of an interface is implicitly
abstract
,
so its body is always represented by a semicolon, not a block. For compatibility
with older versions of Java, it is permitted but discouraged, as a matter of style, to
redundantly specify the
abstract
 modifier for methods declared in interfaces.
Every method declaration in the body of an interface is implicitly
public
. It
is permitted, but strongly discouraged as a matter of style, to redundantly specify
the
public
 modifier for interface methods.
Note that a method declared in an interface must not be declared
static
, or a
compile time error occurs, because in Java
static
 methods cannot be
abstract
.
Note that a method declared in an interface must not be declared
native
 or
synchronized
, or a compile time error occurs, because those keywords describe
implementation properties rather than interface properties. However, a method
declared in an interface may be implemented by a method that is declared
native
or
synchronized
 in a class that implements the interface.
Note that a method declared in an interface must not be declared
final
 or a
compile time error occurs. However, a method declared in an interface may be
implemented by a method that is declared
final
 in a class that implements the
interface.
9.4.1   Inheritance and Overriding
If the interface declares a method, then the declaration of that method is said to
override
 any and all methods with the same signature in the superinterfaces of the
interface that would otherwise be accessible to code in this interface.
If a method declaration in an interface overrides the declaration of a method
in another interface, a compile time error occurs if the methods have different
return types or if one has a return type and the other is
void
. Moreover, a method
189






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

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