Google News
logo
Kotlin - Interview Questions
What is mean by data lasses in koltin?
In java to store data items, we create a class by setting the variables. The setters and gathers are override to hash(), tostring(), and copy() functions.

Whereas in kotlin, we need to add just the keyword data to the class, and everything that remained is done automatically by default.
data class company(var  name: string)

Function main(args  array<string>)
{
Val company= company("Manhas Industries")
}​
Advertisement