It does the same thing. Note here that itemName, calories, and cost hold the same values as in the MandMs constructor, but they are entirely different variables. The fact that they have the same name doesn't mean anything.
Liutauras Vilda wrote:
Didn't manage to decipher class name "MandMs". Maybe because it is not in my native language. But consider the fact that likely you'll need to work in multicultural environment, so always try to choose something simple and clear. Sorry if I misunderstood you here.
Karen Guffey wrote:I do rely on Netbeans, but usually I eventually understand what it's talking about. AND...it's not always right.
Karen Guffey wrote:Sometimes it offers one, I click on it, Netbeans makes the change...& it's still flagged as incorrect. My theory is that the developer of Netbeans didn't anticipate what some novices might try to do.
Campbell Ritchie wrote:if you open
and don't close it. So you need to learn which IDE warnings need to be taken with how large a pinch of salt.
Winston Gutkowski wrote:. . .
Hmmm. TBH, that strikes me as a weakness of System.in, not of the general philosophy.
. . .
And here are way more quicker than me, so we both have where to improve
Karen Guffey wrote:Liutaurus: I was in the middle of editing my last post to include a message to you, but you're too quick for me!
Setter so-called method should set the value of variable after class has been instantiated. For instance when you create an object of your Snack class, you create similarly to:
Karen Guffey wrote:Can you elaborate on the use of a setter method (which is something I've read about but never even attempted to use) in the Snack class? And give me an example of how to call it in the main method?
It is not a secret. Lithuanian. Male.
Karen Guffey wrote:Also, I'd be interested in knowing what your native language is...& if you're male or female!
Karen Guffey wrote:Jason: I actually think I followed pretty much everything you said. Three questions:
1. Actually, I'm asking for confirmation: when I pass a parameter, am I passing only a type? Is it never a variable with a value?
2. What do you mean by "variables of the widest type"?
3. Arrays are not my forte, but I think what you're saying a getter would do in your example is get all the items in the array that fit the condition. Is that correct?
Thank you very much!