but for some reason even though object wd prints out the same as wd2, the equals method still says they are not equal
The only issue I have though is that if I comment out the wd.setArray() method, the equals method says they are not equal even though the values are the same. I guess it might be intended that way since this is a comparison of deep and shallow object copies, not the equality of values.
Array.equals is better for checking the equality of arrays, am I right?
As far as using instanceof in equals methods, we haven't learned that in class yet so I don't want to get too far ahead if what I am doing is working the way we are taught.
Michael D Watson wrote:I would like to have this thread (arrays not equal) deleted please. My professor uses this question every semester...
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|