What will be displayed by the following code?

public class Test1 {
    public static void main(String args[]) {
        System.out.println( 5 ^ 6 & 3);
        // Hint:
        // 0 - 0000        // 5 - 0101
        // 1 - 0001        // 6 - 0110
        // 2 - 0010        // 7 - 0111
        // 3 - 0011        // 8 - 1000
        // 4 - 0100        // 9 - 1001        
    }
}
Explanation
This example uses bitwise operations. The order plays a role. The conjunction & has a higher priority than the exclusive OR ^

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes