This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Question: Can someone tell me how to type the symbol for the Or operator? Usually it's two vertical lines side by side (kinda like this: ll) but I don't know how to do that on the computer keyboard, unless I use the Shift, Alt, Function, and/or Ctrl keys, etc.
Can I just use the word "or" instead of the symbol ??? Also, is the Boolean symbol for Or the same as the arithmetic symbol for Or ???
Will you check my code in the other topic I submitted "Program: Change Due/Tendered"? I know what you said in response to it - I'm still working on compile issues. Specifically, will you check my code within the do...while statement to see if my use of the single vertical line | for the Or operator fits this situation? We just talked about that in this post thread and this part of the program in question deals with it. But I'm having trouble determining whether this case is logical or arithmetic (I'm leaning towards arithmetic, as reflected in my code). Thanks a bunch...
Originally posted by Campbell Ritchie: Varies from country to country. On my keyboard it is at the bottom left, shift-\
It also varies within a country. I'm in the United States and my work keyboard and home keyboard have the key in different places. Which is annoying because you have to remember where you are before touch typing!
General convention is either above/below/next to the "enter" key so at least there are only two places to look.
When both operands of a &, ^, or | operator are of type boolean or Boolean, then the type of the bitwise operator expression is boolean.
As Rob pointed out, the difference is that the || is conditional, in that the right operand is evaluated only if the left operand evaluates to false. See JLS - 15.24 Conditional-Or Operator ||.
(In this context, it seems as if the tutorial might be treating a boolean as a single bit, which I think is a mistake, because the size of a Java boolean is not defined.) [ November 16, 2008: Message edited by: marc weber ]