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

Compulsory non-null initialization

A local variable defined with var must be initialized with its declaration, or the code won't compile. The compiler can't infer the type of an uninitialized variable or a variable that is assigned a null value. The following code won't compile:

var minAge;                   // uninitialized variable 
var age = null;               // variable assigned a null value  

The following image illustrates what would happen if the uninitialized variable age went to seek entrance to the Mr. Java compiler place. The compiler won't let age in:

Variable definition using var must always be accompanied by its initialization, or the code will fail to compile.
主站蜘蛛池模板: 舞阳县| 慈利县| 广宁县| 巴东县| 会宁县| 睢宁县| 汝城县| 长沙县| 山东省| 黎川县| 乐平市| 顺昌县| 连城县| 普洱| 中宁县| 天全县| 同心县| 香格里拉县| 杨浦区| 余江县| 喀喇沁旗| 洪洞县| 富宁县| 依安县| 嘉义市| 连州市| 武清区| 淅川县| 密山市| 得荣县| 辽中县| 罗江县| 泾源县| 徐水县| 革吉县| 宽甸| 梅河口市| 正安县| 滦平县| 阳城县| 芮城县|