class X { private int x; public X(int x) { System.out.println("Skapar en X(" + x + ")."); this.x = x; } public X() { this(0); System.out.println("Skapar en X()."); } public void f() { System.out.println("X.f"); } } // X class XYZ extends X { private int y; private int z; public XYZ(int x, int y, int z) { super(x); System.out.println("Skapar en XYZ(" + x + ", " + y + ", " + z + ")."); this.y = y; this.z = z; } public XYZ(int y, int z) { super(); System.out.println("Skapar en XYZ(" + y + ", " + z + ")."); this.y = y; this.z = z; } public void f() { System.out.println("XYZ.f"); } } // X public class Uppgift3 { X x; public Uppgift3() { x = new XYZ(1, 2, 3); } public static void main(String [] args) { Uppgift3 u = new Uppgift3(); X x1 = new X(); X x2 = new XYZ(4, 5, 6); XYZ xyz = new XYZ(17, 19); u.f(x1); g(x2); } // main public void f(X x) { System.out.println("Uppgift3.f"); x.f(); this.x.f(); } static public void g(X x) { System.out.println("Uppgift3.g"); x.f(); } } // Uppgift3