nullr4pt0r
nullr4pt0r

Reputation: 21

How the logical operators works in java?

I executed the below java code in IDE. the first sysout prints false. where as second sysout prints true. Some websites says because of operator precedence this occurs.

System.out.println(false && true | true);
boolean a = false && true;
boolean b = true;
System.out.println(a | b);

can someone help me to understand ?

I executed on the IDE, false && true | true prints false , where as (false && true) | true prints true. I can't figure out why.

Upvotes: 0

Views: 48

Answers (0)

Related Questions