I will move it there for you, but that is the last time I will move a topic to the appropriate forum for you. You have been around the Ranch long enough to understand about the various forums, and post to the appropriate one. Any other Java topics in the PHP forum will be just locked.
John, we've been over this many times - this site is not for handing you answers, it is about you learning to do stuff yourself. Please finally stop asking for answers, and take seriously what people are telling you.
If it's purely for showing immutability, and presumably what is required for a Map key, then write the Employee class and show us where you get.
posted 1 month ago
Tim Moores wrote:. . . learning to do stuff yourself. . . .
Agree. The problem I can see is much more fundamental than anything about immutability. Were you told to use that design? If so, please discuss the problem with your teacher. I have already pointed out the part I am worried about.
John Ken wrote:How can we write a program using employee object as map key where employee having 3 property ( to check knowledge of immutability)
Along the way of this task also research, why having Map keys which can be mutated is a bad idea. You could easily get some sort of questions in programming job interviews.
posted 1 month ago
Were you really told to use that dreadful design? That object can either be in a consistent state or it can be immutable, in which case it can no longer be relied on to be in a consistent state.
Work out what will happen to an object in a consistent state it you wait long enough. Please work it out; finding the problem isn't rocket science, but it does entail a bit of effort.
By the way: when you said Date did you mean this Date Class? A badly designed class, which nobody should use any more. There is more about immutability in the Java™ Tutorials, and something about dates, too.
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!