For B::foo to override A::foo, it must have the exact same method signature as defined in the Java Language Specification. This means the parameter type must be Building, not Skyscraper. If B::foo uses Skyscraper as the parameter type, it's actually creating a new overloaded method rather than overriding A::foo. When the code calls building.foo(skyscraper), the compile-time type of 'building' is Building, so it looks for foo(Building), and since B::foo(Skyscraper) is a different method signature, it doesn't override A::foo(Building). Therefore, A::foo gets called.
This is different from what you might expect because method overriding requires exact signature matching, while method overloading (which is what happens if you use Skyscraper in B::foo) is resolved at compile-time based on the static types. The runtime type of the object doesn't matter for overloaded methods - only for overridden methods. That's why none of the given options are correct - using any type other than Building in B::foo would result in method overloading rather than overriding, and A::foo would still be called.