например:
Код: Выделить всё
public interface Rectangle {
int height = 0;
int width = 0;
public int getHeight();
public int getWidth();
public void setHeight(int height);
public void setWidth(int width);
}
public class Tile implements Rectangle{
@Override
public int getHeight() {
return 0;
}
@Override
public int getWidth() {
return 0;
}
@Override
public void setHeight(int height) {
}
@Override
public void setWidth(int width) {
}
}
Сначала я думал использовать это с наследованием.
Но дело в том, что мне приходится иметь дело с 3 классами.!
- Прямоугольник
- Плитка
- JLabel.!
Код: Выделить всё
class Tile extends JLabel implements Rectangle {}
но
Код: Выделить всё
class Tile extends JLabel extends Rectangle {}
Подробнее здесь: https://stackoverflow.com/questions/731 ... interfaces
Мобильная версия