What you are effectively doing is creating anonymous classes extending CountryExternalEnum. In each of those you are declaring a getName() method. That's fine - it's just like adding a method to any other class.
But, because it hasn't been added to the CountryExternalEnum class, you can't use it on a CountryExternalEnum reference, which is why you get the error when you refer to it. You'd need to cast it to the anonymous type first (which you can't do, because it's anonymous!).
On the other hand, uncomment the declaration in CountryExternalEnum, and now the methods in the anonymous classes are overriding this, and calling it on a CountryExternalEnum reference is fine.