They should be in the Rational
class since they are abstraction for rational numbers. It would be debatable if you would want to move them to a RationalPolynomial
class, but even then I believe keeping them in Rational
would be better.
A big requirement for doing this is making your Rational
class immutable; otherwise you shouldn't expose them as public. Effective Java mentions at page 76:
Immutable classes should take advantage of this by encouraging clients to reuse existing instances wherever possible. One easy way to do this is to provide public static final constants for frequently used values. For example, the Complex class might provide these constants:
public static final Complex ZERO = new Complex(0, 0);
public static final Complex ONE = new Complex(1, 0);
public static final Complex I = new Complex(0, 1);