You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/ch6_definingclasses.ptx
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -769,8 +769,8 @@ public void test(Number a, Number b) {
769
769
Here is an excerpt from <urlhref="https://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html#compareTo(T)"visual="https://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html#compareTo(T)">the official documentation</url> for the <c>compareTo</c> method as specified by the <c>Comparable</c> interface.
770
770
</p>
771
771
772
-
773
-
<programxml:id="java-comparable"language="text">
772
+
<listingxml:id="java-comparable">
773
+
<programlanguage="text">
774
774
<code>
775
775
int compareTo(T o)
776
776
Compares this object with the specified object for order. Returns a
@@ -782,27 +782,29 @@ iff y.compareTo(x) throws an exception.)
782
782
...
783
783
</code>
784
784
</program>
785
+
</listing>
785
786
786
787
<p>
787
788
To make our <c>Fraction</c> class <c>Comparable</c> we must modify the class declaration line as follows:
0 commit comments