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

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.
主站蜘蛛池模板: 永顺县| 胶南市| 翼城县| 崇信县| 麻阳| 济宁市| 澄城县| 禄丰县| 南汇区| 门源| 自治县| 桐柏县| 苏州市| 基隆市| 浦东新区| 腾冲县| 体育| 蕲春县| 麟游县| 英吉沙县| 南乐县| 怀仁县| 平顶山市| 夏河县| 东阳市| 肃南| 云林县| 凤城市| 上栗县| 阿克陶县| 浦城县| 永宁县| 青龙| 广州市| 胶南市| 连云港市| 新化县| 诏安县| 奈曼旗| 平罗县| 南宁市|