title: Cannot be resolved to a variable in Java
body: <p>I am experiencing this problem in Java.
  When I run the program it gives me the error: variable_name cannot be resolved to a variable.</p>
  <pre><code>if(name.equalsIgnoreCase(&quot;...&quot;)) {
      System.out.print(&quot;...&quot;);
      float name1=SIn.readFloat();
  } else if(name.equalsIgnoreCase(&quot;...&quot;)){
      System.out.print(&quot;...&quot;);
      float name2=SIn.readFloat();
  }
  try {
      float converted=name1*valueget;    //the error is here with the variable 'name'
      System.out.println(...);
  }
  </code></pre>