public boolean equals(Stock object2) {
boolean status;
if(symbol.equals(object2.symbol) &&
sharePrice == object2.sharePrice)
status = true;
else
status = false;
return status;
}
Stock is the class, symbol and sharePrice are fields in the class. What's really confusing me is the symbol.equals(object2.symbol). Is this calling the equals method above or is it using an already written equals method that is part of the API? Also, why doesn't he use the equals method to compare sharePrice? I've been trying to wrap my brain around this for a good hour now, if anyone can shed some light on this it would be greatly appreciated.
EDIT: symbol is a string and sharePrice is a double, sorry forgot to mention this.
This post has been edited by giggly kisses: 11 October 2010 - 12:19 PM

New Topic/Question
Reply



MultiQuote




|