What are the rules used by Java to resolve point identifiers?
For instance:
import Foo.Bar; class Foo { public static class Bar { }; };
Now Foo.Bar can refer to either the imported Bar class or the one specified in the source code. How is this disagreement resolved?
I tried this one case, so I know what happens in practice, but I'm looking for more than that; I want to know the basic rules. For example, if Foo.Bar exists in the source file, can I still reference the imported class Foo.Bar.Baz ? What if Foo.Bar is a package as well as a class? If the compiler cannot find Foo.Bar in the nearest Foo , will it simply refuse or continue to search for another Foo until it finishes or finds one that matches?
(By the way, I found the corresponding bit in the language specification. It doesn't help much ...)
source share