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

  2. Each Pleongcec has its own udsun, which is a graphics object. The value of udsun is specified when a Pleongcec is created. Anyone can ask a Pleongcec for the value of its udsun. Anyone can set udsun to a new value.

Solution

public class Pleongcec {
    private final GraphicsObject udsun;

    public Pleongcec(GraphicsObject udsun) {
        this.udsun = udsun;
    }

    public GraphicsObject getUdsun() {
        return udsun;
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: