title: Singleton class in Kotlin
body: <p>I want to know how to create a singleton class in Kotlin, so that my Util class instantiates it only once per app execution. However, when I converted my Java class to kotlin, the code below was generated.</p>
  <p><strong>Is this correct?</strong></p>
  <pre><code>companion object {
      private var utilProject: UtilProject? = null
  
      val instance: UtilProject
          get() {
              if (utilProject == null) utilProject = UtilProject()
              return utilProject!!
          }
  } 
  </code></pre>
  <p>I could find a related <strong><a href="https://stackoverflow.com/q/40398072/6891563">question</a></strong>, but it is with parameters, and I am not getting it convert without params.</p>