View Single Post
Old Jul 27th, 2007, 11:48 PM   #11
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,007
Rep Power: 5 lectricpharaoh will become famous soon enough
Yes, you've got it, except Java does not interpret 01000000 as being true. You need an explicit comparison when testing any value that is not boolean. Otherwise, you get a compiler error:
int flag = 0;
if(flag != 0)
  System.println("flag is nonzero");
if(flag)  // error
  System.println("flag is nonzero");
The second if() is a problem because it evaluates to this:
if(flag == true)  // error
  System.println("flag is nonzero");
This is comparing an int and a boolean, so you have a type mismatch, and the compiler will choke. But on the boolean operations stuff, it seems you're clear.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote