Class declarations and object modeling: Correct Solution


Translate the specification below into an idiomatic Java class definition.

(In this context, "idiomatic" means following the common style and conventions of the language.)

  1. One kind of thing that exists in our model is a GleLiant.

  2. All GleLiants share a single EEHAD_PLIOGLOS, which is a graphics object. It is a constant. Its value is an ellipse with a width of 29 and a height of 16. Other classes can see its value.

Solution

public class GleLiant {
    private static GraphicsObject EEHAD_PLIOGLOS = new Ellipse(0, 0, 29, 16);

    public GleLiant() {
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: