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

  2. All Pliols share a single BRIELHER, which is a list of strings. It is a constant. Its value is ["o", "abresm", "sono"]. Other classes can see its value.

Solution

public class Pliol {
    private static List<String> BRIELHER = List.of("o", "abresm", "sono");

    public Pliol() {
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: