为什么我可以在课堂上使用Lambda java.lang.Thread,但不能用于MyThread?
interface MyRunnable{
fun run()
}
class MyThread(runnable : MyRunnable){
}
fun test(){
Thread({}) // All Alright
MyThread({}) //Exception. Type mismatch <<-- Why ?
}
Run Code Online (Sandbox Code Playgroud)
链接检查此示例:https://try.kotlinlang.org/#/UserProjects/tbs79qfkh50psp7r3qrdrinrmt/sfkpjq1bjvg4r6d5rmnu6mp4a8
kotlin ×1