Advantages of Data Class in Kotlin

Data Class in Kotlin:

Data classes are a powerful kind of classes that avoid the boilerplate we need in Java to create POJO: classes which are used to keep state but are very simple in the operations they do. They usually only provide plain getters and setters to access their fields.

Advantages of Data Class:

i. It provides a massive amount of self-generated code.

ii. It eliminates a number of lines of code as well.

data class Forecast(val date: Date, val temperature: Float, val details: String)