File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Have a question about operators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Have a question about operators" Watch "Have a question about operators" New topic

Have a question about operators

chang nanny

Joined: Feb 15, 2004
Posts: 14
class SSBool{

public static void main(String[] args){
boolean b1 = true;
boolean b2 = false;
boolean b3 = true;
if(b1 & b2 | b2 & b3 | b2){
if(b1 & b2 | b2 & b3 | b2 | b1){
output is kdokey
Could someone tell why the reason is "okdokey"?
Thank you.
C. Magmanum
Ranch Hand

Joined: Apr 03, 2004
Posts: 35
the output is
compare the values from left to right and evaluate with each step, u might get a better grasp.
Lionel Orellana
Ranch Hand

Joined: Mar 19, 2004
Posts: 87
Originally posted by chang nanny:

& has higher precedence than |. So this is like saying

chang nanny

Joined: Feb 15, 2004
Posts: 14
thank you.
I agree. Here's the link:
subject: Have a question about operators
jQuery in Action, 3rd edition