title: How to know when an object is deallocated in Java?
body: <p>I want to know when an object is deallocated in Java?</p>
  
  <p>If there is a something like <code>deinit</code> in Swift, I can release some resources at there.
  ex)</p>
  
  <pre><code>deinit {
       myResource1.dispose()
       myResource2.release()
       someOtherResource.close()
       ....
  }
  </code></pre>
  
  <p>Is it a bad practice in Java, so that I have to find another way?</p>
  
  <p>Specifically, I want to know when a row in a list view dies. </p>