I'm trying to call a method from another class and I'm just wondering the proper syntax because I'm not understanding how this works.
I have DropOutStack class that extends LinkedStackClass and I would like to call method push(T newElement) that is located in LinkedStackClass From my GuiDropOutStack class. Since super must be first I'm not really sure how to put the method where I would like to use it.
Suppose you make a typo and forget one = (for instance, because you've been coding Visual Basic... unfortunately, I have to sometimes). You then get "f (isFullStack = true)". As a result, true is assigned to isFullStack which is then evaluated - to true, so the if always executes. Not what you had in mind, was it?
It only works with boolean (and Boolean, since Java 5.0). That's because an assignment has a return type as well - the variable type. So if x is an int, then x++, x = 13, x += 5 etc all return an int. Likewise, for a boolean b, b = x returns the new value for b after the assignment. This return value is perfectly legal in if, for, while etc statements. Some compilers / IDEs will warn you, but it is legal.
Joined: Dec 06, 2010
Interesting, I had no idea. I will read up on that. Thank you.