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

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.
主站蜘蛛池模板: 喀什市| 徐州市| 清镇市| 汕尾市| 翁牛特旗| 塔城市| 水城县| 兴隆县| 丰都县| 麦盖提县| 咸丰县| 临夏市| 东阳市| 大悟县| 通江县| 东乡族自治县| 马龙县| 云浮市| 锡林浩特市| 广丰县| 元谋县| 治多县| 泾源县| 澄迈县| 钟祥市| 攀枝花市| 视频| 哈密市| 达州市| 崇左市| 菏泽市| 永嘉县| 孝昌县| 天台县| 昌黎县| 扶风县| 翁源县| 西丰县| 柏乡县| 喜德县| 临城县|