Kotlin: introduction to data classes
Example:
data class User(val name: String, val age: Int)
Data classes in Kotlin are concise and provide several built-in functions.
Solution:
val john = User("John", 25)
print(john.name)
Example: Solution:Kotlin: introduction to data classes
Data classes in Kotlin are concise and provide several built-in functions.
data class User(val name: String, val age: Int)
val john = User("John", 25)
print(john.name)