title: Which is a better practice for if-else condition?
body: <p>Which one of these two options are better?</p>
  
  <pre><code>if(obj.getType!=null &amp;&amp; obj.getData()!=null)
  {
    // Do something
  }
  elseif(obj.getData==null)
  {
    // Do other thing
  }
  
  *OR*
  
  if(obj.getType!=null)
  {  
    if(obj.getData!=null)
    {
      // Do something
    }
    else
   {
     // Do other thing
   }
  }
  </code></pre>
  
  <p>The major point of doubt is why to do null check for getData twice in the first way? The second option does it only once.</p>