/help

Initializing a Double and Integer values inside a private method returns Null in both. But when I'm initializing them normally inside the constructor (without a private method) then everything works perfectly. why? (line 65) Thank you!!
No description
No description
11 Replies
JavaBot
JavaBot11mo ago
This post has been reserved for your question.
Hey @Yarden! 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 closed 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.
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Yarden
YardenOP11mo ago
Thank you, I will check it now
JavaBot
JavaBot11mo 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.
Yarden
YardenOP11mo ago
@Twala Here is the thing I don't understand. Because it's pass-by-value, then the values that suppose to pass into polynomCoeff and PolynomPower are the values of polynom._coefficients.get(index) and polynom._powers.get(index) respectively, since it passes by them value of it... But it passes Null instead of a value, that means both polynom._coefficients.get(index) and polynom._powers.get(index) are null, why? it makes non-sense
Yarden
YardenOP11mo ago
No description
Yarden
YardenOP11mo ago
The pass-by value here are: polynom._coefficients.get(index) and polynom._powers.get(index) right?
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
Kyo-chan
Kyo-chan11mo ago
I mean, constructors and methods aren't different. Here the variables have a conflicting scope because he declared parameters of the same name. It would be the same with a constructor. That normally would have been responded with by that google search Fundamentally, it just does't work to pass around parameters so that they're initialized. So trying to is useless. Instead, whatever you intend to do must be done another way Here it would be easy to not pass the values you want as parameters, as passing null pointers is fundamentally useless, and instead just have the initiliazer method set the fields.
Yarden
YardenOP11mo ago
@Kyo-chan Thank you very much! I've managed to fix the problem
JavaBot
JavaBot11mo 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