public class Unit { static final int MAX_HP = 100; static final int MIN_HP = 0; int hp; public Unit(){ hp = MIN_HP; } public void play(int pcnt){ setHp(hp+pcnt); } private void setHp(int value) { if(value>MAX_HP){ value = MAX_HP; } if(value