1. Retrieve a Context object and display its environment
importjavax.naming.*;importjavax.naming.ldap.*;publicclassGetContext{publicstaticvoidmain(String[]args){try{ // Create an initial contextContext ctx =newInitialContext(); // Get the environment from the ContextHashtable<?,?> env =ctx.getEnvironment(); // Print the environmentfor(Enumeration<?> e =env.keys();e.hasMoreElements();){Object key =e.nextElement();Object value =env.get(key);System.out.println(key +": "+ value);}}catch(NamingExceptione){e.printStackTrace();}}}