Home > Back-end >  About on the use of var identifier in Java
About on the use of var identifier in Java

Time:10-23

, ladies and gentlemen, I am a beginner, about a problem always think impassability,
Here I use a relatively simple program to do a sample
Just write method section
Public static void main (String [] args) {
Byte b=40;
Var c='a';
Var I=23;
Var d=. 314;
Double Po=b + c + I + d;
System. The out. Println (Po);
}
Then both in doc interface operation, and run in the IDE, will prompt the var has a mistake, this is there any solution, you can use the var,
but it won't make mistake

CodePudding user response:

Java10 can use var to define variables, and can only be a local variable, Java10 previous version is not supported

CodePudding user response:

Use var to define a variable is JDK10 version of the new features, can't use var in the previous version
  • Related