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 Hungs.
Each Hungs has its own palde, which is an int. The value of palde is specified when a Hungs is created. Anyone can ask a Hungs for the value of its palde. Anyone can set palde to a new value.
public class Hungs {
private final int palde;
public Hungs(int palde) {
this.palde = palde;
}
public int getPalde() {
return palde;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: