import
java.util.Enumeration;
import
java.util.Properties;
import
javax.naming.CompoundName;
import
javax.naming.InvalidNameException;
public
class
GFG {
public
static
void
main(String[] args)
throws
InvalidNameException
{
Properties props =
new
Properties();
props.put(
"jndi.syntax.separator"
,
":"
);
props.put(
"jndi.syntax.direction"
,
"left_to_right"
);
CompoundName CompoundName
=
new
CompoundName(
"x:y:z:a:m:a:q:e"
,
props);
CompoundName cloneCompound
= (CompoundName)CompoundName
.clone();
System.out.println(
"Clone CompoundName: "
+ cloneCompound);
System.out.println(
"Members:"
);
Enumeration<String> enumeration
= cloneCompound.getAll();
int
i =
1
;
while
(enumeration.hasMoreElements()) {
System.out.println(i +
":"
+ enumeration.nextElement());
i++;
}
}
}