interface IBye{
void Bye();
}
class A {
public A() {
System.out.println("A()");
}
public void sayhi()
{
System.out.println("A::sayhi()");
}
}
class B{
A obj;
public B(){
obj=new A(){
public void sayhi()
{
System.out.println("B_A::sayhi()");
}
};
obj.sayhi();
}
public void impbye()
{
IBye by=new IBye(){
public void Bye()
{
System.out.println("Bye!");
}
};
by.Bye();
}
}
public class Main {
public static void main(String[] args) throws Exception {
B b = new B();
b.impbye();
}
}
/*
A()
B_A::sayhi()
Bye!
*/