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 Sili.
All Silis share a single olDa, which is an int. No other classes can directly ask for the value of olDa. The value of olDa starts out as 19 when the program starts. Every time a new Sili is created, it adds 7 to olDa.
public class Sili {
public static int olDa;
public Sili() {
olDa += 7;
}
public static void onStart() {
olDa = 19;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: