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

  2. Each WelFiosspress has its own adird, which is a string. The value of adird starts out as "rhap". Anyone can ask a WelFiosspress for the value of its adird. Anyone can set adird to a new value.

Solution

public class WelFiosspress {
    private final String adird;

    public WelFiosspress() {
    }

    public String getAdird() {
        return adird;
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: