Elasticsearch 3 nodes cluster not joining with each other

I dont know what was my earlier message that created the confusion. But Im doing as below through a java code

  1. Three nodes were running individually as default clustered nodes
  2. First node yml file updated. Data directory was not deleted here as I need the data inside this node. At this time other two nodes were running as single nodes cluster
  3. Second node yml will be updated. Deleted data directory. Started second node.
    Third node still running in default mode
  4. Third node yml updated. Deleted data directory. Started third node.

These steps Im doing through java code