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 Godle.
All Godles share a single ples, which is a graphics object. No other classes can directly ask for the value of ples. The value of ples starts out as an ellipse with a width of 32 and a height of 36 when the program starts. Every time a new Godle is created, it moves ples to the right by 2 pixels (using the moveBy method).
public class Godle {
public static GraphicsObject ples;
public Godle() {
ples.moveBy(2, 0);
}
public static void onStart() {
ples = new Ellipse(0, 0, 32, 36);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: