public class Gnome {
  // Instance variables:
  protected String name;
  protected int age;
  protected Gnome gnome_buddy;
  private boolean magical = false;
  public double height = 2.6;             // in feet
  public static final int MAX_HEIGHT = 3; // maximum height

  // Constructors:
  Gnome(String nm, int ag, Gnome bud, double hgt) { // fully parameterized
    name = nm;
    age = ag;
    gnome_buddy = bud;
    height = hgt;
  }
  Gnome() { // Default constructor
    name = "Rumple";
    age = 204;
    gnome_buddy = null;
    height = 2.1;
  }

  // Methods:
  public static void makeKing (Gnome h) {
    h.name = "King " + h.getRealName();
    h.magical = true;	// Only the Gnome class can reference this field.
  }
  public void makeMeKing () {
    name = "King " + getRealName();
    magical = true;	
  }
  public boolean isMagical() { return magical; }
  public void setHeight(int newHeight) { height = newHeight; }
  public String getName() { return "I won't tell!"; }
  public String getRealName() { return name; }
  public void renameGnome(String s) { name = s; }
}