I'm looking over PathFinder.java, one of the classes included in jr.jar. I just discovered that the import statement in this class is actually importing an interface, not a class. When you import an interface, do you still have to implement it? I just read that the container is responsible for implementing this particular interface, but I was only aware that interfaces were implemented, not imported! If you do import a different interface in some other class, would you then have to implement it, or how would that work?
No, when you import an interface, you DO NOT have to impelment it. On the other hand, if you implement an interface, you DO have to import it if the interface is declared in a different package than the class that implements it.
To help you understand this, the import statement simply tells the current file which classes and/or interfaces are available to be used. (Okay, there is a little more to it than this, but I'm trying to keep it simple.) Or in other words, whenever you USE a class or interface that belongs to a different package, you MUST import it. It makes no difference whether you use the class or interface as a local variable, member variable, or if you extend a class or implement an interface. In each case, you need to tell the compiler where to find the class or interface. This is what the import statement is for.