title: Points and Segments in Java
body: <p>I have created a Point class and a Segment class. I am trying to find a way to determine if a given point is part of the line segment, by using the absolute difference from the beginning point to the ending point of the segment. It has to be smaller than 0.01, so then the point Is part of my line. 
  I have to do that using a contains method. I am giving you my code below.
  I am beginner. I know I have to do it using only one parameter in the contains method (Point p) but I can't do it right.</p>
  
  <pre><code>`public boolean contains(Point p){
      segment1x = currentPoint.pointX - point1.pointX;
      segment1y = currentPoint.pointY - point1.pointY;
  
      segment2x = point2.pointX - point1.pointX;
      segment2y = point2.pointY - point1.pointY;
  
      absoluteDifference = Math.abs((segment1x*segment2y)-(segment1y*segment2x));
  
      if(absoluteDifference !=0){
          return false;
      }
      return true;
  }`
  </code></pre>