Learn in 2 minutes: @JvmOverloads in Kotlin.

Aanand Shekhar Roy
AndroidPub
Published in
2 min readOct 11, 2017

If you are coming from Java world, you might already have heard about the method overloading in Java. Kotlin, with the help of default parameters and named arguments helps us to reduce the number of overloads that we generally need in Java world.

That means, in Kotlin, you can define a method like

fun bar(a:Int=0, b: Double =0.0, c:String="default value"){
println("a=$a , b=$b ,c = $c")
}

And then call it like

bar(1)

Aanand Shekhar Roy
AndroidPub

Senior Software Engineer @Joist, Author of Kotlin Programming Cookbook.