Back to tasksGet help with live coding in real time with Sobes Copilot
Junior — Senior
128
Разбор вывода программы с companion object в Kotlin
Task condition
Определите, какой набор строк будет напечатан в консоль после запуска следующего кода.
fun main() {
val clazz = TestClass()
clazz.test()
}
class TestClass {
val testInternal = {
println("property test internal")
}
val test = {
println("property test")
test()
}
fun test() {
println("function test")
testInternal()
fun testInternal() {
println("internal function test")
}
}
companion object {
fun test() {
println("Companion test")
}
fun testInternal() {
println("Companion test internal")
}
}
}