視屏中有句話(huà)不懂
在2.52分時(shí)老師說(shuō)“java中父類(lèi)引用數(shù)組保存子類(lèi)對(duì)象”
這個(gè)要如何做呢,以及這個(gè)知識(shí)點(diǎn)在哪里?
求大神告知,也百度了但答案我看不懂。
在2.52分時(shí)老師說(shuō)“java中父類(lèi)引用數(shù)組保存子類(lèi)對(duì)象”
這個(gè)要如何做呢,以及這個(gè)知識(shí)點(diǎn)在哪里?
求大神告知,也百度了但答案我看不懂。
2018-01-22
舉報(bào)
2018-01-23
Multiple markers at this line
?- The constructor Pickup(String, double, int) is
? undefined
?- The constructor Truck(String, double, int) is
? undefined
?- The constructor Truck(String, double, int) is
? undefined
?- The constructor Bus(String, int, int) is undefined
?- The constructor Bus(String, int, int) is undefined
?- The constructor Bus(String, int, int) is undefined
這是你的錯(cuò)誤提示信息,constructor是構(gòu)造器的意思,undefined表示未定義,就是說(shuō)你沒(méi)有這個(gè)類(lèi)的構(gòu)造器,new不了對(duì)象,當(dāng)然默認(rèn)對(duì)象是可以new的,new Bus(),這樣的,里面沒(méi)有參數(shù)
2018-01-23
這就是構(gòu)造器
2018-01-23
缺個(gè)構(gòu)造器
2018-01-23
父類(lèi)數(shù)組引用子類(lèi)對(duì)象還是錯(cuò)誤,
eclipse提示錯(cuò)誤原因:Multiple markers at this line
?- The constructor Pickup(String, double, int) is
? undefined
?- The constructor Truck(String, double, int) is
? undefined
?- The constructor Truck(String, double, int) is
? undefined
?- The constructor Bus(String, int, int) is undefined
?- The constructor Bus(String, int, int) is undefined
?- The constructor Bus(String, int, int) is undefined
不知道自己那一步錯(cuò)了,Car父類(lèi)與其他子類(lèi)都是繼承關(guān)系呀,方法參數(shù)什么的也沒(méi)錯(cuò)呀,
求解答,都卡了兩天了。
2018-01-22
呃..還是你啊哈哈,這也相當(dāng)于是剛剛那個(gè)問(wèn)題吧?