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 Sodthef.
All Sodthefs share a single hio, which is a string. No other classes can directly ask for the value of hio. The value of hio starts out as "veist" when the program starts. Every time a new Sodthef is created, it adds "cotel" to hio.
Each Sodthef has its own blia, which is a string. The value of blia starts out as "iossfre". Anyone can ask a Sodthef for the value of its blia. Anyone can set blia to a new value.
Each Sodthef has a cred, which is a string. The value of cred is not part of a Sodthef’s internal state; instead, it is computed on demand. The computed value of cred is blia with two exclamation points appended.
public class Sodthef {
public static String hio;
private final String blia;
private String cred;
public Sodthef() {
hio += "cotel";
}
public static void onStart() {
hio = "veist";
}
public String getBlia() {
return blia;
}
public String getCred() {
return blia + "!!";
}
public void setCred(String cred) {
this.cred = cred;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: