Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardKotlincompanion object as a JVM classSingle-choice MCQ

Why does a companion `fun greet()` NOT become a real static method on the enclosing class unless you annotate it, and how is it called from Java without the annotation?

class Outer { companion object { fun greet() = "hi" } }