What is the difference between open and public in Kotlin?

Technology CommunityCategory: KotlinWhat is the difference between open and public in Kotlin?
VietMX Staff asked 3 years ago
  • The open keyword means “open for extension“. The open annotation on a class is the opposite of Java’s finalit allows others to inherit from this class.
  • If you do not specify any visibility modifier, public is used by default, which means that your declarations will be visible everywhere. public is the default if nothing else is specified explicitly.