第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

?java.lang.NullPointerException: Cannot invoke "Humen.humen.hoHome()" because "zhangsan" is null為啥出現(xiàn)這個問題

Humen;

com.example.demo2.Car.Car;

ZhangSan?HumenWithCar{
????(Car?car){
????????(car);
????}

????(){
????????.start();
????????.turnLeft();
????????.turnRight();
????????.stop();
????}
}


Humen;

com.example.demo2.Car.Car;

LiSi?HumenWithCar{
????(Car?car){
????????(car);
????}

????(){
????????.start();
????????.turnRight();
????????.stop();
????}
}


com.example.demo2.Car;
java.lang.reflect.Constructor;
java.lang.reflect.InvocationTargetException;
java.util.Map;
java.util.concurrent.ConcurrentHashMap;

IoCContainer?{
????Map<String,?Object>?=?ConcurrentHashMap<String,?Object>();

????Object?(String?beanId)?{
????????.get(beanId);
????}

????(Class<?>?clazz,?String?beanId,?String?...paramBeanIds)?{
????????Object[]?paramValues?=?Object[paramBeanIds.];

????????(i?=?;?i?<?paramBeanIds.;?i++)?{
????????????paramValues[i]?=?.get(paramBeanIds[i]);
????????}
????????Object?bean?=?;
????????(Constructor<?>?constructor?:?clazz.getConstructors())?{
????????????{
????????????????bean?=?constructor.newInstance(paramValues);
????????????}?(InstantiationException?|?InvocationTargetException?|?IllegalAccessException?e)?{
????????????}
????????}
????????(bean==)?{
????????????RuntimeException();
????????}

????????.put(beanId,?bean);
????}
}
com.example.demo2;


Humen.LiSi;
Humen.ZhangSan;
Humen.humen;
com.example.demo2.Car.Audi;
com.example.demo2.Car.Buick;
com.example.demo2.Car.IoCContainer;
org.junit.;
org.junit.jupiter.api.;



Demo2ApplicationTests?{
????IoCContainer?=?IoCContainer();

????(){
????????.setBeans(Audi.,?);
????????.setBeans(Buick.,?);
????????.setBeans(ZhangSan.,?,);
????????.setBeans(LiSi.,?,);

????}
????()?{
?????????humen?zhangsan?=?(humen)?.getBean();
?????????zhangsan.hoHome();

????????humen?lisi?=?(humen)?.getBean();
????????lisi.hoHome();
????}

}


java.lang.NullPointerException: Cannot invoke "Humen.humen.hoHome()" because "zhangsan" is null

正在回答

1 回答

humen這個類名首字母要大寫

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

?java.lang.NullPointerException: Cannot invoke "Humen.humen.hoHome()" because "zhangsan" is null為啥出現(xiàn)這個問題

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號