Why does this provide me with a stack overflow error? <p>The following code yields a stack overflow error, can someone tell me why? (I know how to fix the error, if I reference 'super' instead of 'this' in the <code>add</code> method, but I am not sure why that works.)</p> <pre><code>package subclassingVector; import java.util.Vector; public class MyVectorSubclass extends Vector&lt;MyModelClass&gt; { public MyVectorSubclass(){ MyModelClass m = new MyModelClass(); m.setId(2); this.add(m); if(this.contains(m)){ System.out.println("contains is true"); } } public boolean add(MyModelClass o){ this.add(o); return true; } public boolean contains(Object o){ for(subclassingVector.MyModelClass mmc: this){ if(mmc.equals((MyModelClass) o)){ return true; } } return false; } public static void main(String[] args) { String s = new String("SSEE"); MyVectorSubclass m = new MyVectorSubclass(); } public class MyModelClass { private Integer id = null; public MyModelClass() { // TODO Auto-generated constructor stub } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } } } </code></pre>