How does one create default implementations of int...
# announcements
c
How does one create default implementations of interface methods like in Java, but with Kotlin? For example:
interface Example {
default public void method(){
println("how default method implementations look in java, using the keyword default"
}
s
Just define the method body and add the annotation
@JvmDefault
👍 2
s
you don’t need
@JvmDefault
by default lol
google is your friend
😂 1
c
@Shawn yep looking at this page right now, i think more of what i want is a delegate, but good to see that interfaces can indeed provide default implementations..
👍 1