假设以下场景:
void thisIsCalledManyTimes(){
// ....
someObject.executeIfNecessary( new Runnable(){
void run(){ //do sth here}
});
}
匿名对象需要多少空间?我理解每个匿名对象都会在其方法查找表中具有指向run
相同实现的指针。