Kotlin access modifiers explain


I found no info about access modifiers in documentation. It seems like 'public' is not necessary and 'package private' acts like a public (i can call methods from another packages). Could you explain ?

  • public — visible to everybody
  • internal (or no modifier) — visible to everybody inside the module
  • protected — visible to subclasses
  • private — visible to owner and its members

Some clarification of 'private': if you have something private in a package, subpackages can use it, but sibling/parent packages can not, since they are not members of the declaring package