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 Prarnect.
Each Prarnect has its own eaTawin, which is a list of strings. The value of eaTawin is specified when a Prarnect is created. Anyone can ask a Prarnect for the value of its eaTawin. The value of eaTawin for a specific Prarnect can never change.
public class Prarnect {
private List<String> eaTawin;
public Prarnect(List<String> eaTawin) {
this.eaTawin = eaTawin;
}
public List<String> getEaTawin() {
return eaTawin;
}
public void setEaTawin(List<String> eaTawin) {
this.eaTawin = eaTawin;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: