The purpose of a classpath and import statements are different. Import statements don't find classes. They rely on the classloader to do this, and it uses the classpath.
The import statement tells a
Java class the fully qualified package name of a class being used. You don't need to use it. For example, you could write a class like this:
<blockquote>
code:
<pre name="code" class="core">
package foo.bar;
public class MyClass {
public static void main(String[] args] {
java.util.Date myDate = new java.util.Date(System.currentTimeMillis());
}
}
</pre>
</blockquote>
No import statements, but I've "imported" the class java.util.Date. You can probably see why it is easier to use imports from the example above.