diff --git a/source/ch6_definingclasses.ptx b/source/ch6_definingclasses.ptx
index c1b2d6f..b2a66fa 100644
--- a/source/ch6_definingclasses.ptx
+++ b/source/ch6_definingclasses.ptx
@@ -462,15 +462,16 @@ public class Fraction {
- If you ran the program above you probably noticed that the output is not very satisfying. Chances are your output looked something like this:
+ If you ran the program above you probably noticed that the output is not very satisfying. Chances are your output looked something like
The reason is that we have not yet provided a friendly string representation for our
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.
- However, to make our output nicer we will implement the
+
- is NOT the same as:
+
- Here is an
One important thing to remember about
- Here is code that makes the
Fraction@6ff3c5b5
public String toString() {
return numerator.toString() + "/" + denominator.toString();
}
object1 == object2
object1.equals(object2)
public boolean equals(Fraction other) {
Integer num1 = this.numerator * other.getDenominator();
@@ -608,6 +612,7 @@ public boolean equals(Fraction other) {
}
public class Fraction extends Number {
...
}
- This really isn’t much work for us to implement these methods, as all we have to do is some type conversion and some division:
+ This really isn’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
public double doubleValue() {
return numerator.doubleValue() / denominator.doubleValue();
@@ -702,6 +708,7 @@ public long longValue() {
}
- Suppose you try to define a method as follows:
+ Suppose you try to define a method as
public void test(Number a, Number b) {
a.add(b);
}
The Java compiler would give an error because