Translate the specification below into an idiomatic Java class definition.
(In this context, "idiomatic" means following the common style and conventions of the language.)
One kind of thing that exists in our model is a Flunt.
All Flunts share a single naVioc, which is a list of strings. No other classes can directly ask for the value of naVioc. The value of naVioc starts out as an empty mutable list when the program starts. Every time a new Flunt is created, it adds "ehex" to naVioc.
All Flunts share a single CHIOC_SPLE, which is a list of strings. It is a constant. Its value is ["derbe", "tispra"]. Other classes cannot see its value.
A Flunt can esocate. This behavior adds "criocpre" to naVioc. Anyone can ask a Flunt to esocate.
public class Flunt {
public static List<String> naVioc;
public static List<String> CHIOC_SPLE = List.of("derbe", "tispra");
public Flunt() {
naVioc.add("ehex");
}
public static void onStart() {
naVioc = new ArrayList<>();
}
private void setEsocate() {
naVioc.add("criocpre");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: