class MyClass
   {
   // set up a height property with variable, getter and setter.
   private int height;
   public int getHeight()
      {
      return height;
      }
   public void setHeight (int height)
      {
      if ( 50 < height && height < 275 ) this.height = height;
      }
   }
// ...
// use the getter/setter
x.setHeight( x.getHeight() + 1 );