How to make a class data class ?
Answer / Rajendra Singh Rana
To create a data class in Kotlin, you should use the 'data' keyword followed by the class name and any required properties. For example: data class Person(val name: String, val age: Int). Data classes automatically generate equals(), hashCode(), toString(), and copy() methods.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the use of function extension ?
What is the difference between Const and Val?
What are some of the features which are there in Kotlin but not In Java?
Is there any dependency of Secondary Constructors on Primary Constructors ?
What is the difference between == and === operators in Kotlin?
Does Kotlin support both Explicit conversion and Implicit conversions?
How do you differentiate var and val in Kotin?
What type of programming does Kotlin support?
How do you declare a variable as volatile in Kotlin ?
List the number of constructors available in Kotlin?
What are the features that kotlin support and java doesn’t?
Can you migrate the code from java to kotlin?