We have already discussed the most common static method of all, <c>main</c>. However in our <c>Fraction</c> class we also implemented a method to calculate the greatest common divisor for two fractions (<c>gdc</c>). There is no reason for this method to be a member method since it takes two <c>Integer</c> values as its parameters. Therefore we declare the method to be a static method of the class. Furthermore, since we are only going to use this <c>gcd</c> method for our own purposes we can make it <c>private</c>.
0 commit comments