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

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

Solution

public class Silwe {
    private static GraphicsObject OEA_GEDCRAS = new Rectangle(0, 0, 35, 44);

    public Silwe() {
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: