January 2018
Intermediate to advanced
434 pages
14h 1m
English
In every real-world project, you create classes that don't have any use except for storing data, like in the case of the Student class we described earlier. The number of these types of classes can be way too high in a complex project having many roles and models. This results in a lot of boilerplate code. Kotlin has a great solution for it:
data class Student(var name:String,var roll_number:String,var age:Int)
That's it!
fun main(args: Array<String>) { val student=Student("Aanand","2013001",21) println("Student: name- ${student.name}, roll_number:${student.roll_number}, age:${student.age
Read now
Unlock full access