[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Java libraries and proposal.



> No, it's not that simple: you can always use the completely specified name
> to refer to a class (e.g. "java.util.Vector", even if you don't import the
> package nor the class). The "import" keyword is only there to ease the
> developer's work.

Correct. Many people assume that Java's "import" works like C's "#include",
and it doesn't.

"import" only imports the namespace so that the JVM will look there. It's
much like adding things to your PATH variable so that you can type "vi"
instead of "/usr/bin/vi".

> It's also possible that 2 different (but very close) APIs have classes in
> the same package.

What is Java supposed to do if it encounters two different classes of the
same name in the same package? Does it just take the first one that it
encounters?

- Joe



Reply to: