need help with basic java game programming , class and interfaces constructs
<p>I am a first year programming student. I have coved the basics of precedual programming in c++. I am now fairly new to Java.</p>

<p>Recently i have taken a keen interest into game programming.</p>

<p>my situation:</p>

<p>my situation:</p>

<p>I have a hero class and a rival class. each with thier own members and methods. 
how can i make it possible for the hero to interact with the rival, do i do this through the use of interfaces? for example an interface with an undefined attack method
and have both the class implement that interface?</p>

<p>if so</p>

<p>what should the code look like in the attack method of both classes</p>

<p>something likes this</p>

<p>example:  </p>

<pre><code>      // heros version of implemented method

      public int attack()
      {
             // idealy when hero attacks, the health value will be reduced by 15 of what it is.

             rival1.getHealth(- 15)
      }



      // rival version of implemented method

      public int attack()
      {
             // idealy when rival attacks, the health value will be reduced by 15 of what it is.

             hero1.getHealth(- 15)
      }
</code></pre>

<p>Please help me understanding why we use interefaces and , the anwser to my question </p>

<p>any help or suggestions will be greatly appreciated :) .</p>
