title: View model initialization using "by viewModels()" vs "ViewModelProvider(this).get(ViewModel::class.java)" in android
body: <p>We can initialize the <code>ViewModel</code> class using</p>
  <pre><code>private val viewModel: CharactersViewModel by viewModels()
  </code></pre>
  <p>or</p>
  <pre><code>viewModel = ViewModelProvider(this).get(CharactersViewModel::class.java)
  </code></pre>
  <p>Herer CharactersViewModel is our ViewModel class. My question is when to use which?
  Do both contain the same purpose? I  have read the android official documentation of ViewModel.The documentation says <strong><code>by viewModels()</code> Kotlin property delegate</strong>. But unfortunately failed to understand it. Can anyone help me understand this?</p>