I am new to java and need help with CompareTo. I've created a class of object called planet, each planet has 4 variables: Distance from sun, radius, mass, and number of moons.
How do I make it so that when I say Jupiter.compareTo(Saturn) It tells me which one has the larger radius, as opposed to comparing any of the other variables.
Thanks for any help.
0 · ·