public class MainClass { public static void main(String args[]) { int k = 2; System.out.println( k << 3 >> k == k >> 1 << k); } }
1. k << 3 = 16 (0000 0010b << 3 = 0001 0000b) 2. 16 >> 2 = 4 (0001 0000b >> 2 = 0000 0100b) 3. k >> 1 = 1 (0000 0010b >> 1 = 0000 0001b) 4. 1 << k = 4 (0000 0001b << 2 = 0000 0100b)
Login in to like
Login in to comment
or Read more about Java Quizzes
Login in to like
Login in to comment