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 Puned.

  2. All Puneds share a single SMI_NEETH, which is a graphics object. It is a constant. Its value is a rectangle with a width of 49 and a height of 44. Other classes can see its value.

Solution

public class Puned {
    private static GraphicsObject SMI_NEETH = new Rectangle(0, 0, 49, 44);

    public Puned() {
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: