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

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.
主站蜘蛛池模板: 岳西县| 上高县| 瓦房店市| 韩城市| 卓资县| 平和县| 安宁市| 个旧市| 西林县| 顺昌县| 兰坪| 高密市| 六盘水市| 石城县| 都兰县| 金山区| 山阳县| 大港区| 怀柔区| 临桂县| 东丽区| 大港区| 福贡县| 兴安盟| 棋牌| 呼图壁县| 昔阳县| 赤峰市| 张北县| 共和县| 封开县| 浦江县| 泽普县| 无锡市| 临漳县| 中超| 铜梁县| 杭锦后旗| 南川市| 海原县| 仙居县|