danpost, yes it is part of Greenfoot. A method in the Actor class.
Copy and paste from the API:
getWorld
public World getWorld()
Return the world that this actor lives in.
Returns:
The world, or null if this actor is not in a world.
getWorldOfType
public <W> W getWorldOfType(java.lang.Class<W> worldClass)
Return the world that this actor lives in, provided that it is an instance of the given "worldClass" class (i.e. that it is an instance of worldClass or one of its subclasses).
Returns:
The world this actor is in, or null if either this actor is not in a world
Throws:
java.lang.ClassCastException - If the actor is in a world, but not one that is an instance of worldClass or one of its subclasses
You are right. And that is the bug! One Actor class online, another one offline in the programming environment, and both say version 2.5.
Hope some moderator check this out.