import java.awt.*; import java.awt.geom.Point2D; public class HoidlaKatse2{ public static void main(String[] arg){ Hoidla2 h=new Hoidla2(new Point(0, 0), new Point(3, 4)); System.out.println(h); System.out.println(h.kaugus()); Hoidla2 h2=new Hoidla2( new Point2D.Double(0, 0), new Point2D.Double(3, 4) ); System.out.println(h2); System.out.println(h2.kaugus()); } } /* D:\kasutaja\jaagup\java>java HoidlaKatse2 (java.awt.Point[x=0,y=0], java.awt.Point[x=3,y=4]) 5.0 (Point2D.Double[0.0, 0.0], Point2D.Double[3.0, 4.0]) 5.0 */