I am writing a code and am following all instructions given to me. All the codes and methods look fine when I run the program but the equal method! Based on the instructions, I am supposed to get false when the tested asks if point (a, b)---(c, d) is equals to (e, f)---(g, h), but I get true. Can anyone give me an idea where I am doing wrong?

```js
public boolean equals(Object obj) {
       //if (obj instanceof Segment) {
           //Segment other = (Segment) obj;
           //return p1 == other.getP1() && p2 == other.getP2();
       //}
       //else {

           //throw new IllegalArgumentException("undefined");
       //}

       if(obj == null)
           return false;
       if(this == obj)
           return true;
       //if(!(obj instanceof Segment))
           //return false;

       else if(obj.getClass() != this.getClass())
           return false;

           else {
               Segment S = (Segment)obj;
       if (this.getP1() == S.getP1() &&
                   this.getP2() == S.getP2())
           return true;

       else if(this.getP1() != S.getP1() &&
               this.getP2() != S.getP2()){
           return true;}

       return false;

           }      
           //else if(obj.getP1() != this.getP1() &&
               //   obj.getP2() != this.getP2());
       //   return false;

   }
```