package execisetest;
class Role{
public void attack(Arm p1){
Animal.cutHP=p1.sunshi;
Animal.VaryHp();
}
}
public class Game {
public static void main(String args []){
Arm arm=new Arm();
arm=new MoArm();
Role role=new Role();
role.attack(arm);
}
}
class Arm{
public int sunshi;
}
class MuArm extends Arm{
{sunshi=20;}
}
class TieArm extends Arm{
{sunshi=50;}
}
class MoArm extends Arm{
{sunshi=100;}
}
class Animal{
public static int cutHP;
public static int HP=1000;
public static void VaryHp(){
HP=HP-cutHP;
System.out.println(HP);
}
}