Why is there no static keyword in Kotlin?

Technology CommunityCategory: KotlinWhy is there no static keyword in Kotlin?
VietMX Staff asked 3 years ago

The main advantage of this is that everything is an object. Companion objects can inherit from other classes or implement interfaces and generally behave like any other singleton.

In Java, static members are treated very differently than object members. This means that you can’t do things like implementing an interface or putting your class “instance” into a map or pass it as a parameter to a method that takes Object. Companion objects allow for these things. That’s the advantage.