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
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -766,7 +766,7 @@ public void test(Number a, Number b) {
766
766
767
767
<p>
768
768
The <c>Comparable</c> interface says that any object that claims to be <c>Comparable</c> must implement the <c>compareTo</c> method.
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.
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. <xrefref="java-comparable"text="type-global"/> shows the excerpt.
770
770
</p>
771
771
772
772
<listingxml:id="java-comparable">
@@ -785,7 +785,7 @@ iff y.compareTo(x) throws an exception.)
785
785
</listing>
786
786
787
787
<p>
788
-
To make our <c>Fraction</c> class <c>Comparable</c> we must modify the class declaration line as follows:
788
+
To make our <c>Fraction</c> class <c>Comparable</c> we must modify the class declaration line as shown in <xrefref="java-make-comparable"text="type-global"/>.
789
789
</p>
790
790
791
791
<listingxml:id="java-make-comparable">
@@ -800,7 +800,7 @@ public class Fraction extends Number implements Comparable<Fraction> {
800
800
801
801
<p>
802
802
The specification <c>Comparable<Fraction></c> makes it clear that <c>Fraction</c> is only comparable with another <c>Fraction</c>.
803
-
The <c>compareTo</c> method could be implemented as follows:
803
+
The <c>compareTo</c> method could be implemented as shown in <xrefref="java-compare-to"text="type-global"/>.
0 commit comments