Назад к задачамПолучайте помощь с лайвкодингом в реальном времени с Sobes Copilot
Junior — Senior
24
Разбор вывода программы с companion object в Kotlin
Условие задачи
Определите, какой набор строк будет напечатан в консоль после запуска следующего кода.
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")
}
}
}