Sail E0 Webinar
Question


What is the output of this program?


class rightshift_operator {
public static void main(String args[])
{
int x;
x = 10;
x = x >> 1;
System.out.println(x);
}
}
Options:
A .  10
B .  5
C .  2
D .  20
Answer: Option B

Right shift operator, >>, devides the value by 2.
output:
$ javac rightshift_operator.java
$ java rightshift_operator
5



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers