Hi Nithya,
As Jean Vincent pointed out, following would be the modified code:
XWikiObject xobj = new XWikiObject();
//Class Name is XWikiGroups
xobj.setClassName("XWiki.XWikiGroups");
//Host page to which we want to add the user is the Page
which contains the group
//In this case, XWikiAllGroup is the group to which we
want to add the user
//So, we would use XWiki.XWikiAllGroup Page in the wiki
xobj.setPageId("XWiki.XWikiAllGroup");
//Set member property as "XWiki.UserName"
xobj.setProperty("member", "XWiki.nithya");
rpc.storeObject(xobj);
And, for me the password update did work. For some reason, it was not
working in the first attempt. Thanks for your help :)