官术网_书友最值得收藏!

Breaking existing code

As of Java 10, var is a restricted local variable type and cannot be used for type declarations. Code that uses var as the name of a class, interface, method, method parameters, or variables, will no longer compile in JDK 10 and later releases.

The following is an example of code that uses var at multiple places and won't compile:

class var {}          // can't use var as class name
interface var {} // can't use var as interface name
class Demo {
int var = 100; // can't use var as instance variable
// name
static long var = 121; // can't use var as static variable
// name

void var() { // can't use var as method name
int var = 10; // cant use var as the name of a local
// variable
}
void aMethod(String var) {} // can't use var as the name of method parameter
}
It is important to test your production code with the latest Java release versions, even if you are not planning to deploy your production code to them. It will help to iron out any compatibility issues with your production code, helping to migrate it to a future version of Java.
主站蜘蛛池模板: 济源市| 永州市| 沙坪坝区| 隆子县| 柳州市| 勐海县| 泾川县| 焉耆| 抚顺县| 古蔺县| 安康市| 静宁县| 沙洋县| 廉江市| 横峰县| 宝清县| 井陉县| 华阴市| 咸丰县| 房产| 鲁甸县| 炎陵县| 隆化县| 沅江市| 宁城县| 吴旗县| 曲周县| 滨海县| 喜德县| 元阳县| 大埔区| 宁河县| 盱眙县| 夹江县| 深水埗区| 天津市| 尉犁县| 通辽市| 建宁县| 屏山县| 年辖:市辖区|