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 Brurnash.
All Brurnashs share a single udIr, which is an int. No other classes can directly ask for the value of udIr. The value of udIr starts out as 2 when the program starts. Every time a new Brurnash is created, it adds 3 to udIr.
Each Brurnash has a anTro, which is a string. An anTro is part of the internal state of a Brurnash: no other classes can see the value of anTro or directly change it. When a Brurnash is first created, the value of its anTro starts out as "ocus".
A Brurnash can tesify. This behavior adds 6 to udIr. Anyone can ask a Brurnash to tesify.
public class Brurnash {
public static int udIr;
public String anTro = "ocus";
public Brurnash() {
udIr += 3;
}
public static void onStart() {
udIr = 2;
}
private void setTesify() {
udIr += 6;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: