seniorKotlin
How does Kotlin handle compile-time vs runtime polymorphism?
Updated May 16, 2026
Short answer
Kotlin supports runtime polymorphism via inheritance and compile-time via generics and overloading.
Deep explanation
Runtime polymorphism is achieved through method overriding and dynamic dispatch. Compile-time polymorphism is achieved via function overloading and generics, resolved during compilation. JVM uses virtual method tables for runtime dispatch, which introduces slight overhead compared to static dispatch.
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro