8.1.4
Superinterfaces
CLASSES
In the example:
public interface Colorable {
void setColor(int color);
int getColor();
}
public interface Paintable extends Colorable {
int MATTE = 0, GLOSSY = 1;
void setFinish(int finish);
int getFinish();
}
class Point { int x, y; }
class ColoredPoint extends Point implements Colorable {
int color;
public void setColor(int color) { this.color = color; }
public int getColor() { return color; }
}
class PaintedPoint extends ColoredPoint implements Paintable
{
int finish;
public void setFinish(int finish) {
this.finish = finish;
}
public int getFinish() { return finish; }
}
the relationships are as follows:
The interface
Paintable
 is a superinterface of class
PaintedPoint
.
The interface
Colorable
 is a superinterface of class
ColoredPoint
 and of
class
PaintedPoint
.
The interface
Paintable
 is a subinterface of the interface
Colorable
, and
Colorable
 is a superinterface of
Paintable
,
a
s defined in  9.1.3.
A class can have a superinterface in more than one way. In this example, the class
PaintedPoint
 has
Colorable
 as a superinterface both because it is a superinter 
face of
ColoredPoint
 and because it is a superinterface of
Paintable
.
Unless the class being declared is
abstract
, the declarations of the methods
defined in each direct superinterface must be implemented either by a declaration
in this class or by an existing method declaration inherited from the direct super 
class, because a class that is not
abstract
 is not permitted to have
abstract
methods ( 8.1.2.1).
136






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