interface A {
}
interface B {
}
class X implements A, B {
}
class Y implements A {
B makeB() {
// Anonymous inner class:
returnnew B() {
};
}
}
publicclass MainClass {
staticvoid takesA(A a) {
}
staticvoid takesB(B b) {
}
publicstaticvoid main(String[] args) {
X x = new X();
Y y = new Y();
takesA(x);
takesA(y);
takesB(x);
takesB(y.makeB());
}
}