package massiivid; public class TasandiPunkt extends Asukoht{ int x, y; public TasandiPunkt(int x, int y){ this.x=x; this.y=y; } public int getX(){return x;} public void setX(int uusX){x=uusX;} public double kaugusNullist(){return Math.sqrt(x*x+y*y);} private String tutvustus(){return "Tasand";} public static void main(String[] arg){ TasandiPunkt p1=new TasandiPunkt(1, 2); System.out.println(p1.tutvustus()); TasandiPunkt p2=new RuumiPunkt(1, 2, 3); System.out.println(p2.tutvustus()); RuumiPunkt p3=(RuumiPunkt)p2; System.out.println(p3.tutvustus()); } }