实际上匿名类就是
</pre><pre name="code" class="java">interface a{
f();
}
new a(){
f(){
print('');
}
};
e.g.
interface Service{
void method1();
void method2();
}
interface ServiceFactory{
Service getService();
}
class Implementation1 implements ServiceFactory{
priviate Implementation1();
xxxx;
public static ServiceFactory f = new ServiceFactory(){
public Service getService(){
return new Implementation1();
}
};
}