Kotlin supports four types of visibility modifier (access modifiers)--
internal. Kotlin does not support
private Java modifiers. The main difference between a Kotlin and Java modifier is that the default visibility modifier in Kotlin is
public, and it's not required to specify it explicitly, so it can be omitted for a particular declaration. All of the modifiers can be applied to various elements divided into two main groups based on their declaration site: top-level elements and nested members.
A quick reminder from Chapter 3, Playing with Functions: top level elements are elements declared directly inside the Kotlin file, as opposed to elements nested inside a class, object, interface, or function. In Java, we can only declare classes and interfaces at the top level, while Kotlin also allows functions, objects, properties, and extensions there.
First, we have top-level element visibility modifiers:
public(default): Element is visible...