java:initializing_classes_and_constructors
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
java:initializing_classes_and_constructors [2020/09/16 17:51] – mithat | java:initializing_classes_and_constructors [2020/09/16 17:58] – [equals(other)] mithat | ||
---|---|---|---|
Line 153: | Line 153: | ||
<code java> | <code java> | ||
public boolean equals(ClickerCounter other) { | public boolean equals(ClickerCounter other) { | ||
- | return (this.count() == other.count() && this.maxCount == other.maxCount); | + | return (this.count() == other.getCount() && |
+ | | ||
} | } | ||
</ | </ | ||
- | It's up to you to decide what " | + | It's up to you to decide what " |
+ | |||
+ | <code java> | ||
+ | if (myCounter.equals(yourCounter) { | ||
+ | System.out.println(" | ||
+ | } else { | ||
+ | System.out.println(" | ||
+ | } | ||
+ | </ | ||
Copyright © 2020 Mithat Konar. All rights reserved. | Copyright © 2020 Mithat Konar. All rights reserved. |
java/initializing_classes_and_constructors.txt · Last modified: 2020/09/16 18:15 by mithat