title: Using an Interface in an ArrayList
body: <p>Okay so I have an Interface and 2 classes that implement it. The only problem is both classes have methods within them that aren't listed in the interface. I have a test class that uses an ArrayList of the interface type:</p>
  
  <pre><code>ArrayList&lt;Company&gt; employees = new ArrayList&lt;Company&gt;();
  </code></pre>
  
  <p>The program is designed to allow creation of two seperate classes of employees </p>
  
  <pre><code>public class Salaried implements Company 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Hourly implements Company
  </code></pre>
  
  <p>and allow certain methods to be used with them. The two classes both implement the interface, but also have additional methods unique to themselves. </p>
  
  <p>In the test class, I'm trying to use the arrayList to store the different employees that are created, so that their methods can be used later. However the program won't compile as I use methods that aren't in the interface when creating the employees and it won't let me use those methods. </p>
  
  <p>How should I go about fixing this? Is it a mistake within the interface or within the classes themselves? </p>