And one more question please. If we remove an object from the world using the removeObject () method, is an entry removed in the List or null is added, that is, the list in order remains the same or is truncated with a shift?
I believe that you only need a reference to an object in a field when there is a need for it -- that is, when some other method (or methods) in the class needs to reference the object. These tend to be things like (1) the main character; and (2) graphic user interface actors (buttons, scores, notices, etc); for the main world -- and, for actors, (1) appendages (turret for tank, body parts that move, etc); (2) partners (teleports, triggers matched to specific objects, etc); (3) actors being sought out, seen; (4) actors touched (in some instances); and (5) actors acquired (inventory). These are not exhaustive lists.
If we remove an object from the world using the removeObject () method, is an entry removed in the List or null is added, that is, the list in order remains the same or is truncated with a shift?
The entry is removed from the list, shortening it.
Thank you again, but I talked a little about something else. I'm not talking about the convenience of creating games in Greenfoot. I'm talking about learning Java using Greenfoot. In Java, you don't add objects like that, so for learning the language, I think it's better to explicitly specify the links. In Java, you cannot create an object simply by calling new Crab (). At least he won't live like this for a long time, and he won't be able to interact with him.
Greenfoot IS Java. Its classes are provided to allow a beginner to start creating games and simulations right from the start. I believe you are correct in that the tutorial should mention how you can inspect an object in greenfoot. Right-clicking on the world and selecting Inspect on the pup-up will show all field values, not just from in MyWorld, but also from in World. The same goes for an Actor object. Inspecting an actor will show fields provided in the Actor class (namely: x, y, rotation, image and world) as well as fields you declare in its specific class.
At least, your children would be able to see what fields are provided this way. Note that it is not usually a good idea to duplicate a field in a subclass.