935019 wrote:None of this really tells us anything useful.
I want to Create a class called Employee with attributes name and salary.
and if i Pass employee objects as values to map and do the following.
a.Print all the entries.
b.Remove an entry.
c.Replace an entry.
d.Look up a value.
e.Iterate through all the entries.
I am not getting the actual data but Im getting the hashcodeNo, you are getting out exactly what you put in. But when you do System.out.println(someEmployee), you haven't told Java what it should print. Since didn't override the toString() method, in Employee, it's using the one inherited from Object, and since println() ends up calling toString(), that's what you're seeing.
somi wrote:Because of the name clash (argument and instance variable names) the setter method needs 'this' to reference the instance variable but the getter method has no name clash so 'this' is not needed.
Curious to know why you have only used this reference in the setter methods and not in the getter methods.