Variable default value

前端 未结 2 646
时光取名叫无心
时光取名叫无心 2021-01-20 01:18

\"It is important to point out that the content field of the template is by default set to null (as Java does with all noninitialized object fields upon creation).\"

2条回答
  •  甜味超标
    2021-01-20 01:33

    Yes, this is true, but it may not mean quite what you think it means. All object fields will be initialized to null if no value is specified, but primitive types have other default values. For instance, int fields default to 0, floats to 0.0, and booleans to false.

    More information on these defaults here: http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html.

提交回复
热议问题