diff --git a/source/ch6_definingclasses.ptx b/source/ch6_definingclasses.ptx index 252ec9b..07b6931 100644 --- a/source/ch6_definingclasses.ptx +++ b/source/ch6_definingclasses.ptx @@ -196,6 +196,7 @@ public void setDenominator(Integer denominator) { Writing a constructor

+ constructor Once you have identified the instance variables for your class the next thing to consider is the constructor. In Java, constructors have the same name as the class and are declared public. They are declared without a return type. @@ -207,7 +208,7 @@ public void setDenominator(Integer denominator) { public Fraction(Integer top, Integer bottom) { - num = top; + num = top; // notice the use of num instead of top den = bottom; } @@ -228,7 +229,7 @@ public Fraction(Integer top, Integer bottom) { public Fraction(Integer num, Integer den) { - this.num = num; + this.num = num; // notice how we use this.num instead of num this.den = den; }