A

Admin • 833K Points
Coach

Q. Which of the following is the correct way to declare a data class?

  • (A) data class User(val name: String)
  • (B) class User(val name: String) data
  • (C) val User = data class(name: String)
  • (D) data(User: class String)
  • Correct Answer - Option(A)
  • Views: 10
  • Filed under category Kotlin
  • Hashtags:

Explanation by: Admin

'data class' is the correct way to define a data-holding class in Kotlin.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.