Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. public class AnimalSimulator {
  3.  
  4.     public static void main(String[] args) {
  5.         Animal animal = new Cat();
  6.         animal.display();
  7.         animal.doMove();
  8.        
  9.         Animal anotherAnimal = new Fish();
  10.         anotherAnimal.display();
  11.         anotherAnimal.doMove();
  12.        
  13.         Animal theOtherAnimal = new Bird();
  14.         theOtherAnimal.display();
  15.         theOtherAnimal.doMove();
  16.         theOtherAnimal.setMove(new WalkBehavior());
  17.         theOtherAnimal.doMove();
  18.     }
  19. }