This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
teh reason given that all instances of a generic class have the same runtime class so getClass() returns java.util.Vector.
In that case, the answer should have been true true true true.
Appreciate a clarification on this.
Thanks in advance.
Mateusz Kwasniewski
Greenhorn
Joined: Apr 18, 2006
Posts: 15
posted
0
Yes, I think you're right. The answer should be true true true true.
Each call to employeeList.getClass(),employeeIdList.getClass(), employeeProfileList.getClass() returns class java.util.Vector so both comparisions with == return true.
On the other hand, to find out why equals returns true in both cases you should remember that List interface overrides equals. API says:
...two Lists are defined to be equal if they contain the same elements in the same order.
Since in our example the vectors are empty we get true twice.
Even if you have someting like:
You will get true.
It's my first post here, so please correct me if I'm wrong