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 pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Kotlin interview questions

View all →