Visibility Modifiers
suggest changeIntroduction
Kotlin has four visibility modifiers.
Public: visible from anywhere. This is the default.
Private: visible only inside the declaring class, or inside the file for a top-level declaration.
Protected: visible inside the declaring class and its subclasses. Not allowed on top-level declarations.
Internal: visible anywhere in the same module.
Syntax
<visibility modifier> val/var <variable name> = <value>
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents