Here's a class that extends Thread and overrides the run method:
class MyThread : Thread() {
override fun run() {
println("Hello from $name")
}
}
And a snippet of code:
fun main() {
val t1 = MyThread()
t1.name = "My-thread-1"
t1.start()
t1.join()
val t2 = MyThread()
t2.name = "My-thread-2"
t2.start()
println("output-1")
t2.join()
println("output-2")
}
In what order may the strings be printed out? Select all possible cases. Note that Output case: is not part of the output.