黄舟2017-04-18 10:46:47
In fact, only basic types have default values, mainly to prevent null pointer exceptions. User-defined types need to be initialized by the user
伊谢尔伦2017-04-18 10:46:47
Only class variables have default values and do not need to be initialized manually
阿神2017-04-18 10:46:47
When we create a new object, Java will apply for a memory area in Heap to store the class data. The member variables are the data of the class and are also placed in this memory area. When we do not initialize the variable, the data in the Heap has no reference. At this time, if this variable is used elsewhere in the program, a null pointer exception will be thrown!
黄舟2017-04-18 10:46:47
Maybe he needs a clean object. Wiping it clean every time is very tiring. . . (nonsense)