Hi Rob! I'm not sure I understand the question. Why are you trying to get rid of the ampersand? Are you trying to avoid calling the getInt() method twice? If so, use a temporary variable. Also, the single ampersand is a bitwise AND operator; you should use the double ampersand (&&) to logically AND together two boolean expressions. Anyway, depending on what you are trying to do, you could do the following:
However, this is a problem because "i" really can't be both less than zero and greater than 255 at the same time, so I think we may be missing something here. How about a little more detail on what you are trying to accomplish? Joe
Joined: Jul 15, 2003
Hey Joe!! I was just curious if there was another way of writing it - I saw a classmate's code and it looks every bit like mine... we do have explicit instructions but.... I can see what you mean though How are you doing? Rob
Joined: Jun 23, 2003
I'm doing great, Rob, thanks for asking! Good luck on your assignment. Joe
I generally only trust this in my head if I know input1 is not null. Cause if a null slips by the first test it will cause a null pointer exception in the second. As mentioned above you are calling getInt() twice, which is common enough but still offensive to some.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi