The teacher in our programming lessons is talking about "unqualified names", but I'm wondering what they really are.
I suspect that things such as method names are unqualified, but I'm not certain.
Is there anyone who can explain this to me? I need to know this because I need to explain in what way Java looks an unqualified name up.
A qualified name is one with a full path, e.g.:
An unqualified name has just the last part:
The term can apply to fields and methods too.
So, if you can import classes, why would you ever need to use a qualified name?
You need it when you're using two classes that, while they're from different packages, share the same name. A classic example is the ridiculously named class from the JDK:
which incidentally extends
It's reasonably common to need references to instances of both class, so you need code that looks like:
If you use two homonymous classes, there's no avoiding qualifying at least one - you can import one, but importing both creates an ambiguity.