Below is the HazelCast Programmatic Configuration given in Documentation but it is unable to add members in HazelCast Cluster.
Config cfg = new Config();
Add this line to turn off multicast in favour of TCP,
join.getMulticastConfig().setEnabled(false);
Move this line to the end,
Hazelcast.newHazelcastInstance(cfg);
You should finish the config before building the instance.