Class declarations and object modeling: Correct Solution


Translate the specification below into an idiomatic Java class definition.

(In this context, "idiomatic" means following the common style and conventions of the language.)

  1. One kind of thing that exists in our model is a Shust.

  2. Each Shust has a tiTe, which is a string. A tiTe is part of the internal state of a Shust: no other classes can see the value of tiTe or directly change it. When a Shust is first created, the value of its tiTe starts out as "ec".

Solution

public class Shust {
    public String tiTe = "ec";

    public Shust() {
    }
}

Things to check in your solution:

Acceptable variations in the solution:


Related puzzles: