title: What is the best way to clean up an Object in Java?
body: <p>We don't have any destructor in Java as we have in C++. </p>
  
  <p><strong>Q1.</strong> How should we clean up any Object in java.</p>
  
  <p><strong>Q2.</strong> Is there any alternative to a finally block.</p>
  
  <p><strong>Q3.</strong> Sometimes we have to call explicitely initialization/termination of a third party code from our class e.g.</p>
  
  <pre><code>public classs MyClass{
      public MyClass(){
          ThirdPartyInitialize();
      }
  
      protected void finalize(){
          ThirdPartyTerminate();
      }
  }
  </code></pre>
  
  <p>Is this the correct way?</p>