A

Admin • 833.24K Points
Coach

Q. How do you declare a block of code that executes only once in Kotlin?

  • (A) block()
  • (B) once()
  • (C) object
  • (D) init
  • Correct Answer - Option(D)
  • Views: 22
  • Filed under category Kotlin
  • Hashtags:

Explanation by: Admin

The 'init' block is used to initialize code when a class is instantiated.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.