Java operator related interview questions and answers

          

Java operator related interview questions and answers


<<Previous  Next>>

Java operator interview questions

What is the difference between the >> and >>> operators?
What is the difference between the Boolean & operator and the && operator?

Java operator - Jan 15, 2009 at 8:10 am by Amit Satpute

What is the difference between the >> and >>> operators?

">>" is a signed right shift
">>>" is an unsigned right shift.

If >> is applied on a negative number, the result will still be negative.
>>> ignores the sign of the number.
If >>> is applied on a negative number,the result will be a positive number

The >> fills from the left with the sign bit (0 or 1).
The >>> zero-fills from the left.

What is the difference between the Boolean & operator and the && operator?

For Integers:
"&" is the "bit-wise AND" operator.
For boolean arguments:
"&" constitutes the (unconditional) "logical AND" operator
"&" always evaluates both arguments.

"&&" is defined for two boolean arguments.
It is the "conditional logical AND" operator.
"&&" ealuates the first argument. if it is true, it then evaluates the second.

<<Previous  Next>>
Why does Java strictly specify the range and behavior of its primitive types?

Java strictly specifies the ranges for primitive values. The selection of values in integer or floating point types differs based on the requirement of an application.................

Explain the two ways that the members of a package can be used by other packages.

There are two ways of affecting access levels. One, when the classes in the Java platform are used within the developer defined classes, the access levels determine the members of those class which can be used by the developer defined classes................

What is difference between sets and lists?

Sets can have unique values. Lists can have duplicate values................



Write your comment - Share Knowledge and Experience


 

 
Interview questions
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring