having issues with Cannot invoke "java.util.ArrayList.size()" because "this.listOfMicronutrients" is

can not seem to figure it out ?
No description
No description
No description
8 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Jflash! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Kyo-chan
Kyo-chan2mo ago
........ Your list won't exist as long as you don't create it?
Jflash
JflashOP2mo ago
i dont understand your question? or you saying if i dont initialize it ?
Kyo-chan
Kyo-chan2mo ago
something like that, yes I mean, I'm talking about objects not existing if you don't create them, you have an error saying something is null... Do you really need more?
Jflash
JflashOP2mo ago
i dont think i do i am just trying to reslove the null issue. and i thought i have initialize it and that would be in the main function correct? i am guessing i need to properly initialized it?
forge44
forge442mo ago
Are you familiar with how scope works? Initializing it in one class doesn’t mean you have access in another, even if they have the same name.. hard to glean much from a couple of screenshots. But yea Kyo’s right Or if both objects are set equal to one another, both will only reference the same object (or in this case null value) as long as one isn’t set to a new object using the new keyword (or set = to some other object), in which case they’ll no longer reference the same object. Since that’s how Reference Types work.
Jflash
JflashOP2mo ago
I rewrite the code and it got fix. thank you for the help.
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server