concept package level in category kotlin

appears as: package level, package level
The Joy of Kotlin

This is an excerpt from Manning's book The Joy of Kotlin.

But, unlike Java, private constructors aren’t needed to prevent instantiation of utility classes containing only static members. Kotlin puts static members at the package level, outside of any class.

Listing 13.5 The Player class
private class Player(id: String,    #1  
             private val sound: String,    #2  
             private val referee: Actor<Int>):
                            AbstractActor<Int>(id) {    #3  

    override fun onReceive(message: Int, sender: Result<Actor<Int>>) {
        println("$sound - $message")    #4  
        if (message >= 10) {
            referee.tell(message, sender)    #5  
        } else {
            sender.forEach(
                { actor: Actor<Int> ->    #6  
                    actor.tell(message + 1, self())
                },
                { referee.tell(message, sender) }    #7  
            )
        }
    }
}

#1   The class is private because it’s defined at package level. You could also define it as a local class, inside the main function of the program.
#2   The Sound string is a message that’s displayed by the players when they receive the ball (either Ping or Pong).
#3   Each player is created with a reference to the referee so that a player can give the ball back to the referee when the game is over. This wouldn’t be necessary if the Player class was defined locally in the same function as the referee (for example, in the main function).
#4   This is the business part of the actor, meaning the part that does what the user expects to see.
#5   If the game is over, gives the ball back to the referee.
#6   Otherwise, sends it back to the other player if present.
#7   If the other player isn’t present, registers an issue with the referee.