I declared var type variable however the program throws compilation error. Can someone suggest the reason for this error?
var avg2 = 10.0;
Error:
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:
class VarTypeVariables {
public static void main (String args[]){
var avg2 = 10.0;
}
}
varworks in Java 10+var