I want to get answer 4, but my code prints 2. I don't know why?
public class Test {
    public static void main(String[] args) {
        System.out.println(9 >> 2);
    }
}
I want to get answer 4, but my code prints 2. I don't know why?
public class Test {
    public static void main(String[] args) {
        System.out.println(9 >> 2);
    }
}
 
    
     
    
    Yes it will give you 2
because
9 binary representation is 1001, and when you applied the right shift by 2 it will give you 0010
thats why
9 >> 2 = 2
