I am trying to get a handle on the above. I understand that an interface contains method signatures with no implementation. That task is left up to the classes that implement the interface. I am struggling to understand though how interfaces relate to API. We import packages into our classes when we want to use arraylists or fonts right? But what interface are we implementing? Any help would be appreciated…thanks
java.awt.font==>Provides classes and interface relating to fonts.
You’re not implementing any interface by
importing a package–you’re just providing some syntactic sugar to make writing Java code marginally less painful than it would be otherwise. In the bytecode, everything is always fully-qualified.An interface may define an API, or it may be part of an API.
A package may contain an API, or be part of an API, or just random stuff.
You’re only implementing an interface if you actually implement an interface–otherwise you’re just using an interface, or referencing an interface. This requires that a package/class/interface be imported, but simply importing the same is not sufficient.