hardStudy question · answer published in Kotlin interview questions, so no pointsandroidkotlindata-classes
Property declared in the class body
What does this print?
data class User(val id: Int) {
var name: String = ""
}
val a = User(1).apply { name = "Asha" }
val b = User(1).apply { name = "Ravi" }
println(a == b)Discussion 0
Join free to post in the discussion.
Related questions
- Android activity start orderMobile App Developer
- Kotlin Elvis operatorMobile App Developer
- Kotlin val with a mutable listMobile App Developer
- Kotlin data class equalityMobile App Developer
- What AndroidManifest.xml is forMobile App Developer
- Sharing text to any appMobile App Developer
- Play Console rejects the build versionMobile App Developer
- lateinit or by lazyMobile App Developer