title: java linked list problem
body: <p>I have written some Java code with 3 simple classes where the first, Controller, has the main method and creates the instances of the other classes. Floaters is a classes that creates a linked list of Floater instances, each with a particular length and boolean value to say if they are vertical or not. My problem, as it says in the commented lines of the first class, is that both "humans" and "otters" Floaters instances are getting assigned the same values and thus have the same size....</p>
  
  <p>Any suggestions on how to fix this?</p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>public class Controller{
  
     private static Floaters humans;
     private static Floaters otters;
  
     public static void main(String[] args)
     {
             otters = new Floaters();
             humans = new Floaters();
  
             otters.addFloater(2, true);
             otters.addFloater(3, true);
  
             //this should read "2" and it does
             System.out.println(otters.size());
  
             //this should read "0" but reads "2". Why?
             //How can I get it to read "0"?
             System.out.println(humans.size());
     }
  }
  
  
  import java.util.LinkedList;
  
   public class Floaters {
  
     private static LinkedList&lt;Floater&gt; llf;
  
     Floaters()
     {
             llf = new LinkedList&lt;Floater&gt;();
     }
  
     public void addFloater(int length, boolean is_vertical)
     {
             Floater floater = new Floater(is_vertical, (byte)length);
             llf.add(floater);
     }
  
     public int size()
     {
             return llf.size();
     }
  }
  
  public class Floater {
  
     int length;
     boolean is_vertical;
  
     Floater(boolean is_vertical,  int length)
     {
             this.length = length;
             this.is_vertical = is_vertical;
     }
  }
  </code></pre>