public class InterfaceProg {
public static void main (String [] args) {
X x = new X(1, 1, 1);
Y y = new Y(1, 1, 1);
Z z = new Z(1, 1, 1);
System.out.println (x.getx());
System.out.println (x.gety());
System.out.println (x.getz());
System.out.println (y.getx());
System.out.println (y.gety());
System.out.println (y.getz());
System.out.println (z.getx());
System.out.println (z.gety());
System.out.println (z.getz());
}
interface Interface {
int getx();
int gety();
int getz();
}
public static class X implements Interface {
int x;
int y;
int z;
X (int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public int getx() { return this.x + 1;}
public int gety() { return this.y + 1;}
public int getz() { return this.z + 1;}
}
public static class Y implements Interface {
int x;
int y;
int z;
Y (int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public int getx() { return this.x + 2;}
public int gety() { return this.y + 2;}
public int getz() { return this.z + 2;}
}
public static class Z implements Interface {
int x;
int y;
int z;
Z (int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public int getx() { return this.x + 3;}
public int gety() { return this.y + 3;}
public int getz() { return this.z + 3;}
}
}