title: Public method outside of public class
body: <p>The objective is to write code to determine the closest x,y coordinate to (24,5). Using a public class PointXY with 2 instance variables. Then a public method outside of the class that returns the point closest to (24,5). I know I'm not doing it right as the ArrayList of type PointXY is confusing me. Thank you help in advance.</p>
  
  <pre><code>    public class PointXY {
          private int x;
          private int y;
  
  }
  
  public PointXY closest_24_5(ArrayList&lt;PointXY&gt; b) {
          ArrayList&lt;PointXY&gt; nums = new ArrayList&lt;PointXY&gt;();
          nums.add(new PointXY(3,6));
          int total = Integer.MAX_VALUE;
          for(int i=0; i&lt;nums.size();i++) {
                  int dx = 24 - this.x;
                  int dy = 5 - this.y;
                  int thisDistance = Math.sqrt(dx*dx + dy*dy);
                  if(thisDistance&lt;total) {
                      total=thisDistance;
                  }
          }
          return total;
  }
  </code></pre>