Java中默認(rèn)構(gòu)造函數(shù)
提問(wèn)人:榮凡88發(fā)布時(shí)間:2020-10-13
每個(gè)類至少有一個(gè)構(gòu)造函數(shù)。
如果不編寫構(gòu)造函數(shù),則自動(dòng)添加默認(rèn)構(gòu)造函數(shù):
1.默認(rèn)構(gòu)造函數(shù)不帶參數(shù)
2.默認(rèn)構(gòu)造函數(shù)函數(shù)體為空
不必編寫構(gòu)造函數(shù)就能使用new Xxx()創(chuàng)建
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>