help with null pointer exception in Java
<p>I am putting together a simple simulated network in java, where i can add computers, servers, and connect two objects with ethernet ports.   This is where the null pointer exception is being thrown, when i call "this.etherPort.addElement(t);"</p>

<p><code>        </p>

<pre><code>import java.util.Vector;

public class Server extends Computer{

     public Vector&lt;Ethernet&gt; etherPort; 

     public void addPort(Ethernet t)
  {
   this.etherPort.addElement(t);
  }
}
</code></pre>

<p></code></p>

<p>This code is run when i make a new Ethernet object using this code:</p>

<p><code>    </p>

<pre><code>public class Ethernet {
</code></pre>

<p>public Computer terminal1, terminal2;
 public int volume;
    public Ethernet(Computer term, Server term2)
     {
  this.terminal1 = term;
  this.terminal2 = (Computer) term2;
  if(term != null)
  {
   term.addPort(this);
  }
  if(term2 != null)
  {
   term2.addPort(this);
  }
 }
    }
</code></p>
