20 lines
556 B
Java
20 lines
556 B
Java
// reuse/DerivedSpaceShip.java
|
|
// (c)2020 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com for more book information.
|
|
|
|
public class
|
|
DerivedSpaceShip extends SpaceShipControls {
|
|
private String name;
|
|
public DerivedSpaceShip(String name) {
|
|
this.name = name;
|
|
}
|
|
@Override
|
|
public String toString() { return name; }
|
|
public static void main(String[] args) {
|
|
DerivedSpaceShip protector =
|
|
new DerivedSpaceShip("NSEA Protector");
|
|
protector.forward(100);
|
|
}
|
|
}
|