Skip to content

Commit e15fa0c

Browse files
committed
added listing to text and program tags
1 parent 8c74405 commit e15fa0c

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

source/ch6_definingclasses.ptx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public class Fraction {
462462

463463
<introduction>
464464
<p>
465-
If you ran the program above you probably noticed that the output is not very satisfying. Chances are your output looked something like this:
465+
If you ran the program above you probably noticed that the output is not very satisfying. Chances are your output looked something like <xref ref="java-no-friendly-output" text="type-global"/>.
466466
</p>
467467

468468
<listing xml:id="java-no-friendly-output">
@@ -552,8 +552,7 @@ Fraction@6ff3c5b5
552552

553553
<p>
554554
We are not interested in most of the methods on that list, and many Java programmers live happy and productive lives without knowing much about most of the methods on that list.
555-
However, to make our output nicer we will implement the <c>toString</c> method for the <c>Fraction</c> class.
556-
A simple version of the method is provided below.
555+
However, to make our output nicer we will implement the <c>toString</c> method for the <c>Fraction</c> class. <xref ref="java-tostring" text="type-global"/> shows a simple version of the method.
557556
</p>
558557

559558
<listing xml:id="java-tostring">
@@ -576,28 +575,28 @@ public String toString() {
576575
Therefore once you write your own <c>equals</c> method:
577576
</p>
578577

579-
<listing xml:id="java-class-equalequal">
580-
<program language="java">
578+
<listing xml:id="java-class-equal-equal">
579+
<program>
581580
<code>
582581
object1 == object2
583582
</code>
584583
</program>
585584
</listing>
586585

587586
<p>
588-
is NOT the same as:
587+
<xref ref="java-class-equal-equal" text="type-global"/> is NOT the same as <xref ref="java-class-dot-equals" text="type-global"/>.
589588
</p>
590589

591590
<listing xml:id="java-class-dot-equals">
592-
<program language="java">
591+
<program>
593592
<code>
594593
object1.equals(object2)
595594
</code>
596595
</program>
597596
</listing>
598597

599598
<p>
600-
Here is an <c>equals</c> method for the <c>Fraction</c> class:
599+
<xref ref="java-fraction-equals" text="type-global"/> is an <c>equals</c> method for the <c>Fraction</c> class.
601600
</p>
602601

603602
<listing xml:id="java-fraction-equals">
@@ -637,11 +636,11 @@ public boolean equals(Fraction other) {
637636
</p>
638637

639638
<p>
640-
Here is code that makes the <c>Fraction</c> class a child of <c>Number</c>:
639+
<xref ref="java-class-extends" text="type-global"/> makes the <c>Fraction</c> class a child of <c>Number</c>.
641640
</p>
642641

643642
<listing xml:id="java-class-extends">
644-
<program language="java">
643+
<program>
645644
<code>
646645
public class Fraction extends Number {
647646
...
@@ -689,7 +688,7 @@ public class Fraction extends Number {
689688
</p>
690689

691690
<p>
692-
This really isn&#x2019;t much work for us to implement these methods, as all we have to do is some type conversion and some division:
691+
This really isn&#x2019;t much work for us to implement these methods, as all we have to do is some type conversion and some division as shown in <xref ref="java-object-type-conversions" text="type-global"/>.
693692
</p>
694693

695694
<listing xml:id="java-object-type-conversions">
@@ -725,7 +724,7 @@ public long longValue() {
725724
</p>
726725

727726
<p>
728-
Suppose you try to define a method as follows:
727+
Suppose you try to define a method as <xref ref="java-ugly-add-method" text="type-global"/>.
729728
</p>
730729

731730
<listing xml:id="java-ugly-add-method">

0 commit comments

Comments
 (0)