I'm learning Java a bit from a book called "Thinking in Java" and I thought of trying out some inheritance/polymorphism. But I ran into a bit of a code that I don't really like the way it is. Here it goes...

```
class Person{
    private int hp, attack, speed;
    public status() { System.out.println("HP : " + hp + ", ATT : " + attack + ", SPD : " + speed); }
    public punch(){ System.out.println( " punches"); }
    public getPunched(){ hp -= 5; }
    /* plus standard getters/setters to save up your time */
}
class Bob extends Person{
    private String name = "Bob";
    public Bob(){ setHp(100); setAttack(25); setSpeed(15); }
    public punch(){ System.out.println(name); super.punch(); }
    public getPunched(){ System.out.println(name + " gets punched"); super.getPunched(); }
}
class Jake extends Person{
    private String name = "Jake";
    public Jake(){ setHp(120); setAttack(30); setSpeed(10); }
    public punch(){ System.out.println(name); super.punch(); }
    public getPunched(){ System.out.println(name + " gets punched"); super.getPunched(); }
}

```

Now this all works as is (there might be a few spelling errors, my version is a bit longer, so I retyped a shorter one here).

What I wonder is, is there a way I can make the methods punch() and getPunched() from classes Bob and Jake not repeat themselves? More specifically, can I put both of them in a class Person, while keeping the function where a person will still print out its child name ("Bob/Jake punches"), or do I have to put it in a static function elsewhere? If I have to put it in a function, how would it have to look like, since I'm also using the reserved command "super".

I know this code looks very trivial and useless, sorry about that, but it's intended to be, so I can really see what I'm doing while writing the code.

Thanks! :)

**EDIT** : While writing this I realized I can just make a protected String name in the parent class "Person" and via a setter override the variable in each of child constructors, *But* I'm still interested *if* it's possible to address to a child variable, and how would one do that.