Here's a class that extends the Thread class and overrides the run method:
class MyThread(name: String) : Thread(name) {
override fun run() {
println("Hello from $name")
}
}
Take a look at a code snippet:
fun main() {
val t1 = MyThread("My-thread-1")
t1.start()
val t2 = MyThread("My-thread-2")
t2.start()
println("Finished")
}
Select the correct statement about the order of lines in the output: