title: Calculate distance between two points in java
body: <p>I'm kind of new to Java, and trying to write a code that calculate the distance of two points 2 and 3, and scale of 10. Somehow, it does not work. Can you give me a hint, so I can fix the code?</p>
  
  <pre><code>import java.lang.Math;
  
  public class Point {
      int x, y;
  
      public Point (int x, int y){
          this.x = x;
          this.y = y;
      }
      public float scale(int factor) {
          new Point(x * factor, y * factor);
          return factor;
      }
      public float distance(){
          double distance = Math.sqrt(x * x + y * y);
          return distance;
      }
      public void main(String[] args) {
          float p = new Point(2,3).scale(10);
          System.out.println(distance);
      }
  
      }
  </code></pre>