How to use Java 8 feature of default method in interface written in Kotlin
问题 I have a class A in java and interface B in Kotlin. // kotlin interface B { fun optional() } // java class A implements B { } I want to write the default method (Java 8 feature) in Kotlin interface (B) and want to implement it in the class A. How can I achieve it? Thanks in advance. 回答1: In Kotlin, interface methods with bodies are by default compiled as following: // kotlin interface B { fun optional() { println("B optional body") } } is compiled roughly to: public interface B { void