A directory interface is an extension of a naming interface. A naming interface allows names and objects to be associated through a binding, whereas a directory interface allows you to associate objects and attributes. Thus, in addition to being able to look up an object through its name, you can also look up its attributes or perform searches for objects that contain certain attributes.
In a typical file directory service, for example, you would not only have names and files associated but also the files'attributes such as size and creation time.
To use the directory interface of the JNDI, you will need to import the following from the javax.naming and javax.naming.directory packages:
import javax.naming.Context; import ...