test9.18

来源:互联网 发布:软件qa岗位职责 编辑:程序博客网 时间:2024/05/16 12:47
interface Cycle{
void description();
}
interface Unicycle extends Cycle{}
interface Bicycle extends Cycle{}
interface Tricycle extends Cycle{}
class Ufactory implements Unicycle{
public void description(){System.out.println("Unicycle factory");}
}
class Bfactory implements Bicycle{
public void description(){System.out.println("Bicycle factory");}
}
class Tfactory implements Tricycle{
public void description(){System.out.println("Tricycle factory");}
}


public class Test18 {
public static void one(Ufactory uf)
{Cycle c=uf;c.description();}
public static void two(Bfactory bf)
{Cycle c=bf;c.description();}
public static void three(Tfactory tf)
{Cycle c=tf;c.description();}
public static void main(String[] args) {
one(new Ufactory());
two(new Bfactory());
three(new Tfactory());
}
}
0 0