source fie name:  Action.java

import java.io.*;

class ActionPoint

{

int x,y;

public ActionPoint(int p,int q)

{

x=p;y=q;

}

public ActionPoint()

{

x=0;y=0;

}

public void disppoint()

{

System.out.println("x: "+x+" y= "+y);

}

public void length(ActionPoint O,ActionPoint P)

{

double len;

len=Math.sqrt((P.x-O.x)*(P.x-O.x)+(P.y-O.y)*(P.y-O.y));

System.out.println("distance of point from origin("+O.x+","+O.y+")="+len);

}

}

class Action

{

public static void main(String args[])

ActionPoint p1=new ActionPoint();

p1.disppoint();

ActionPoint p2=new ActionPoint(10,10);

p2.disppoint();

ActionPoint p3=new ActionPoint(5,7);

p3.disppoint();

p1.length(p1,p2);

p1.length(p1,p3);

}

}

output:

D:\JavaPrograms\Constructors>javac Action.java

D:\JavaPrograms\Constructors>java Action
x: 0 y= 0
x: 10 y= 10
x: 5 y= 7
distance of point from origin(0,0)=14.142135623730951
distance of point from origin(0,0)=8.602325267042627