title: Use of unassigned local variable 'x'
body: <p>This code:</p>
  
  <pre><code>int a;
  if(a==1){ do something}
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Image img;
     if(img!=null){do something}
  </code></pre>
  
  <p>These codes generates the error:</p>
  
  <blockquote>
    <p>Use of unassigned local variable 'variable-name'</p>
  </blockquote>
  
  <p>I know what exactly this error says and how to resolve it. but what I wonder is that </p>
  
  <ol>
  <li>Shouldn't a variable that is declared and not assigned a value, have a value? like <code>null</code> for the <code>Image</code></li>
  </ol>
  
  <p>2.Why wouldn't it allow to even compare the variable? it can simply say that it doesn't match.</p>