This ought to be really really simple, but I am watching "2+2=5". I hope someone can sort this out!
I have written a program which calls a method in another class and all 6 parameters are supplied from yet another class. Like this:
System.out.println("running pantry update"+ settings.type + settings.dir);
pantry.getPantryData(settings.type, settings.dir, settings.shaulCb, settings.lhaulCb, settings.skiCb, settings.barsCb);
settings is an object of the Settings class and pantry is an object of the pantry class.
The first 2 parameters are String objects and the last 4 are boolean values.
The println statement confirms that the values to be passed to the receiving method are indeed correct (right value and class type). This is also confirmed in the receiving method.
What absolutely baffles me at the moment is why the above method call does not work properly but if I replace the settings.type and settings.dir with literal values it works perfectly???
System out above produces: running pantry updateB763O/B which is great. This information is even carried to into the called method where the value is compared in an if statement. But the result is always false.
BUT if I change the method call as follows:
pantry.getPantryData("B763", "O/B", settings.shaulCb, settings.lhaulCb, settings.skiCb, settings.barsCb);
effectively replacing those 2 values with literals, it all works perfectly!
There are no compilation or runtime errors (except for the fact that the data is not evaluated against the if statement!
Why would that be?
If settings.type = B763 (this is a String variable), why do I have to write "B763" in the method call???
Any ideas would be appreciated.