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

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.
主站蜘蛛池模板: 温州市| 昭通市| 九江市| 马山县| 九台市| 永州市| 拉孜县| 会东县| 肇州县| 高雄县| 沅江市| 桃园县| 阳西县| 乐平市| 长治市| 通山县| 宜宾市| 清原| 赣州市| 鱼台县| 靖远县| 万山特区| 高邑县| 栖霞市| 大悟县| 金平| 伊春市| 石城县| 霍州市| 台南县| 武隆县| 南华县| 墨竹工卡县| 龙山县| 易门县| 奉节县| 西藏| 桃园县| 太白县| 沁阳市| 武乡县|