title: How to solve the problem: int cannot be dereferenced
body: <p>Here I have some value which two of them are integer and I can't call a method on them since they are not reference. How can I solve this?</p>
  
  <pre><code>String srcAddr, dstAddr, protocol;
  int srcPort, dstPort;
  
  public int hashCode() {
  
          final int prime = 31;
          int result = 1;
          result = prime * result + ((dstAddr == null) ? 0 : dstAddr.hashCode());
          result = prime * result + ((dstPort == null) ? 0 : dstPort.hashCode());
          result = prime * result + ((srcAddr == null) ? 0 : srcAddr.hashCode());
          result = prime * result + ((srcPort == null) ? 0 : srcPort.hashCode());
          return result;
  
  }
  </code></pre>
  
  <p>Also, I have an equal method too, a part of it with the error is shown below ,which the same as above I can not compare int with a null.</p>
  
  <pre><code>@Override
  public boolean equals(Object obj) {
  
      if (srcPort == null) {
          if (other.srcPort != null)
              return false;
      } else if (!srcPort.equals(other.srcPort))
          return false;
  
      if (srcPort == null) {
          if (other.srcPort != null)
              return false;
      } else if (!srcPort.equals(other.srcPort))
          return false;
  }
  </code></pre>
  
  <p>How can I solve this error?</p>