• +91 9723535972
  • info@interviewmaterial.com

Kotlin Interview Questions and Answers

Question - How to create a Singleton class in Kotlin?

Answer -

A singleton class is a class that is defined in such a way that only one instance of the class can be created and is used where we need only one instance of the class like in logging, database connections, etc.

To create a Singleton class in Kotlin, you need to use the object keyword.

object AnySingletonClassName

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners