Previous | Next | Trail Map | The Basics | Naming Operations

Creating and Destroying a Context

The Context interface contains methods for creating and destroying a subcontext, a context that is bound in another context of the same type. In a file system, this corresponds to creating and removing a subdirectory.

Creating a Context

To create a context, you supply to createSubcontext()(in the API reference documentation) the name of the context that you want to create.
// Create the context
Context result = ctx.createSubcontext("new");
This example creates a new context, called "new", that is a child of ctx. If you list the context ctx, you will see that there is now an entry for "new".

Destroying a Context

To destroy a context, you supply to destroySubcontext()(in the API reference documentation) the name of the context to destroy.
// Destroy the context
ctx.destroySubcontext("new");
This example destroys the context "new" in the context ctx.

Naming Operations: End of Lesson

What's next? Now you can:


Previous | Next | Trail Map | The Basics | Naming Operations