title: Why is java var type variables not working?
body: <p>I declared var type variable however the program throws compilation error. Can someone suggest the reason for this error?</p>
  
  <pre><code>var avg2 = 10.0;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>javac "VarTypeVariables.java" (in directory: S:\29032020 Java\12 Var Type Variables)
  VarTypeVariables.java:12: error: cannot find symbol
          var avg2 = 10.0; //type based on 10.0 (i.e double)
          ^
    symbol:   class var
    location: class VarTypeVariables
  1 error
  Compilation failed.
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>class VarTypeVariables {
      public static void main (String args[]){
          var avg2 = 10.0; 
      }
  }
  </code></pre>