The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Dev.java for updated tutorials taking advantage of the latest releases.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.
You can rename an object in a context by using Context.rename().
// Rename to Scott S ctx.rename("cn=Scott Seligman", "cn=Scott S");
This example
renames the object that was bound to "cn=Scott Seligman" to "cn=Scott S". After verifying that the object got renamed, the program renames it to its original name ("cn=Scott Seligman"), as follows.
// Rename back to Scott Seligman ctx.rename("cn=Scott S", "cn=Scott Seligman");
For more examples on renaming of LDAP entries check out the Advanced Topics for LDAP users lesson.