operators

What is && operator?

1) Difference between β€˜Β»β€™ and β€˜Β»>’ operators in java?

β€˜Β»β€™ is a right shift operator shifts all of the bits in a value to the right to a specified number of times.

int a =15; a= a Β» 3;

The above line of code moves 15 three characters right.

> > > is an unsigned shift operator used to shift right. The places which were vacated by shift are filled with zeroes.

2) What is the difference between the β€œ==” and β€œ===” operators in Java?

The β€œ==” operator compares the values of two variables to see if they are equal, while the β€œ===” operator compares the references of two variables to see if they point to the same object in memory.

3) What is the difference between the β€œ&” and β€œ&&” operators in Java?

The β€œ&” operator is a bitwise operator, while the β€œ&&” operator is a logical operator. The β€œ&” operator compares each bit of the first operand to the corresponding bit of the second operand, while the β€œ&&” operator only evaluates the second operand if the first operand is true.

4) What is the difference between the β€œ|” and β€œ||” operators in Java?

The β€œ|” operator is a bitwise operator, while the β€œ||” operator is a logical operator. The β€œ|” operator compares each bit of the first operand to the corresponding bit of the second operand, while the β€œ||” operator only evaluates the second operand if the first operand is false.

5) What is the difference between the β€œ^” operator and the β€œ!” operator in Java?

The β€œ^” operator is a bitwise operator that compares each bit of the first operand to the corresponding bit of the second operand, while the β€œ!” operator is a logical operator that negates the value of a boolean expression.

6) How does the β€œinstanceof” operator work in Java?

The β€œinstanceof” operator checks if an object is an instance of a certain class or one of its subclasses. It returns true if the object is an instance of the specified class, and false otherwise.

7) What is the difference between the β€œΒ«β€ and β€œΒ»β€ operators in Java?

The β€œΒ«β€ operator is a bit shift operator that shifts the bits of the first operand to the left by the number of positions specified by the second operand. The β€œΒ»β€ operator is a bit shift operator that shifts the bits of the first operand to the right by the number of positions specified by the second operand.

8) How does the β€œ+=” operator work in Java?

The β€œ+=” operator is a shorthand operator that is used to add the value of the right operand to the value of the left operand, and then assigns the result to the left operand. For example, the statement β€œx += y” is equivalent to β€œx = x + y”.

9) How does the β€œ-=” operator work in Java?

The β€œ-=” operator is a shorthand operator that is used to subtract the value of the right operand from the value of the left operand, and then assigns the result to the left operand. For example, the statement β€œx -= y” is equivalent to β€œx = x - y”.

10) How does the β€œ*=” operator work in Java?

The β€œ*=” operator is a shorthand operator that is used to multiply the value of the left operand by the value of the right operand, and then assigns the result to the left operand. For example, the statement β€œx *= y” is equivalent to β€œx = x * y”.

11) How does the β€œ/=” operator work in Java?

The β€œ/=” operator is a shorthand operator that is used to divide the value of the left operand by the value of the right operand, and then assigns the result to the left operand. For example,the statement β€œx /= y” is equivalent to β€œx = x / y”.

Questions? : Reach Out