Created
June 16, 2017 15:44
-
-
Save gwpantazes/e7b79700c5851d4de5675c34df082d42 to your computer and use it in GitHub Desktop.
Java Bitwise Operators work as logical operators: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2 | |
class BitwiseOperatorAsLogicalTest { | |
public static void main(String[] args) | |
{ | |
System.out.println("Bitwise AND operator still works as logical."); | |
System.out.println(true & true); | |
System.out.println(true & false); | |
System.out.println(false & true); | |
System.out.println(false & false); | |
System.out.println("Bitwise OR operator still works as logical."); | |
System.out.println(true | true); | |
System.out.println(true | false); | |
System.out.println(false | true); | |
System.out.println(false | false); | |
System.out.println("Bitwise XOR operator still works as logical."); | |
System.out.println(true ^ true); | |
System.out.println(true ^ false); | |
System.out.println(false ^ true); | |
System.out.println(false ^ false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment