public abstract class Door {
public abstract void openDoor();
public abstract void closeDoor();
}
public interface Lock {
public abstract void openLock();
public abstract void closeLock();
}
public class SafeDoor extends Door implements Lock{
@Override
public void closeDoor() {
System.out.println("关门....");
}
@Override
public void openDoor() {
System.out.println("开门....");
}
@Override
public void closeLock() {
System.out.println("上锁。。。。");
}
@Override
public void openLock() {
System.out.println("解锁。。。");
}
}
public class Test {
public static void main(String[] args) {
SafeDoor safeDoor = new SafeDoor();
safeDoor.openLock();
safeDoor.openDoor();
safeDoor.closeDoor();
safeDoor.closeLock();
}
}
public abstract class Door {
public abstract void openDoor();
public abstract void closeDoor();
}
public interface Lock {
public abstract void openLock();
public abstract void closeLock();
}
public class SafeDoor extends Door implements Lock{
@Override
public void closeDoor() {
System.out.println("关门....");
}
@Override
public void openDoor() {
System.out.println("开门....");
}
@Override
public void closeLock() {
System.out.println("上锁。。。。");
}
@Override
public void openLock() {
System.out.println("解锁。。。");
}
}
public class Test {
public static void main(String[] args) {
SafeDoor safeDoor = new SafeDoor();
safeDoor.openLock();
safeDoor.openDoor();
safeDoor.closeDoor();
safeDoor.closeLock();
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)