This is the example found on page 88, typed in as it was in the book. Here's my code:
class GameShape {
public void displayShape() {
System.out.println("displaying shape");
}
}
class PlayerPiece extends GameShape {
public void movePiece() {
System.out.println("moving game piece");
}
}
class TilePiece extends GameShape {
public void getAdjacent() {
System.out.println("getting adjacent tiles");
}
}
public class TestShapes {
public static void main(
String[] args) {
PlayerPiece player = new PlayerPiece();
TilePiece tile = new TilePiece();
doShapes(player);
doShapes(tile);
}
public static void doShapes(GameShape shape) {
shape.displayShape();
}
}
This compiles without an issue, but when executing, I get the following error:
Exception in
thread "main" java.lang.NoClassDefFoundError: TestShapes
Any help?