title: How to check if object is null or not except == null
body: <p>I want to make method that will check if the class instance is null or not.</p>
  
  <p>Simply I know that i can use <code>== null</code>, but I want to know that is there any other way that can be implemented to check if instance is null or not ?</p>
  
  <p>I have nearly <code>70-80</code> class instance. &amp; all that class extend same Class <code>BaseEntity</code>.</p>
  
  <p>at time of declaration I have declare each instance like :</p>
  
  <p>Entity1 instance1 = null;</p>
  
  <p>like so I have defined all <code>70 class instances</code>.</p>
  
  <p>when they will be used I am initializing them using new.
  but at end of my main <code>Entity Processor</code>, I have to store data of each Entity id it is initialized, so for that I ll have to check if instance is null or not ?</p>
  
  <p><code>All Entities extend</code> same class <code>BaseEntity</code> so I have made following method.</p>
  
  <p>I know only one method :</p>
  
  <pre><code>public boolean checkIfEntityNull(BaseEntity entity){
          return  entity != null ? true : false;
  }
  </code></pre>
  
  <p>if it returns <code>true</code> then I ll call it's <code>save method of repository to save data in DB</code> otherwise it ll not call save method.</p>
  
  <p>So any guidance on it guys.</p>