Classes and Objects (part-II)

Learn how to use data classes, init blocks, and secondary constructors in our Kotlin program.

The data classes

We can take this one step further by writing the keyword, data, before the compact class:

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy