/* * Author: G Towell * File: Animal.java * Desc: A very basic definition of an animal */ public class Animal { /************* * The only thing know about every animal, its ID. * And that ID, once set, can never change. */ private final String id; /******* * The default constructor. But overridden to make it private. * Therefore no one can ever use it! * */ private Animal() { // NEVER USE THIS id=null; } /**** * The constructor of Animal that should be used. * @param id the identifier of the animal */ public Animal(String id) { this.id=id; } /*** * Get the id * @return the id */ public String getId() { return id; } }