我不知道爲什麼我得到一個NullPointerException。我在這裏錯過了什麼?爲什麼我得到一個NullPointerException與我的數組?
public class CustomJourneyUserInformation {
public IJourneyDetails journeyDetails;
public IUserDetails userDetails;
public ISubscribeJourney subscribedToJourneys;
}
IJourneyDetails,IUserDetails,ISubscribeJourney是所有接口
在不同的活動中,我打電話
private CustomJourneyUserInformation[] allJourneyDetails;
allJourneyDetails = new CustomJourneyUserInformation[subscribedToJourneys.length];
if (providerDetails[i] != null)
>>> allJourneyDetails[i].journeyDetails = providerDetails[i];
if (userDetails[i] != null)
allJourneyDetails[i].userDetails = userDetails[i];
if (subscribedToJourneys[i] != null)
allJourneyDetails[i].subscribedToJourneys = subscribedToJourneys[i];
我正在排隊一個空指針異常由>>>>
標我相信allJourneyDetails[i]
在這裏爲null。
感謝您的編輯,無論如何都在考慮進行更改。 – Siddharth
可能重複的[Java - 爲什麼我會得到這個NullPointerException?](http://stackoverflow.com/questions/9968336/java-why-am-i-getting-this-nullpointerexception) – DocMax