This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
but area is declared final. That means, if an object has length = 4 and breadth = 2 then area is calculated as 8. Later on when this object is changed, lets say, length is changed to 3 , area will still remain 8 because it is final.
That does not mean this object with values (3,2,8) equal to object with values (3,2,6). Please clarify where i am wrong.
Well I don't think you should seek for an answer after changing a question. Each question is designed with a strategy. If there were getter and setters for length and width, then they might have provided definition of the equals method or might have removed final from area. So don't go in too much depth for a question. I think this question is too ambiguous. The real exam is not ambiguous at all. So don't worry
Don't we have risk of loss of precision here in this line??
I think the reason for not choosing this may be that there is still chance of loss of precision of the hash code being calculated as you are using long in the expression and also casting the value back to int.