If I'm commenting the overrided hashcode method in my pojo, I'm getting the set size as 6, which is perfect, since when I instantiate
employee object I will be getting a unique hashcode and all the objects are stored in set.

If I uncomment both the overrided hashcode and overrided equals method, I'm getting the result as expected.

Please clarify why I'm getting count as 6 when I'm uncommenting
overrided hashcode method and commented the overrided equals method. Here the hashcode are duplicated but still I have the size of the set as 6.

Please clarify why I'm getting count as 6 when I'm uncommenting
overrided hashcode method and commented the overrided equals method.
Here the hashcode are duplicated but still I have the size of the set
as 6.

In this case you are generating hash code and commentted equals method.So equals method of Object class get called on the Employee objects you putting in set, and as per Object class equals implementation as :

It chacking the references are same or not (which you are putting in Set which are different) that's the reason you got the count 6. This is the expected behavior of Set means it doesn't allowed duplicate as per equals.

Update :

But when I comment hashcode and uncomment my equals still I'm getting
the count as 6.

When you comment hashcode and uncomment euqls method again Object class hashcode mehtod will call to generate hashcode for the object and it's different for each object. so naturally if hashcodes are different than object are different hence Set allowed them and you get 6.(as in your question you sysout the hashcode of objects just see the difference by commenting and uncommenting the hashcode method in employee class you will get to know what I mean.)

Email codedump link for Why it is not possible to differentiate objects only with hashcode while storing it in Hashset, why it works when I override equals and hashcode