and or java code example

Example 1: java or

int num = 9;

if (num == 1 || num == 2) {
  System.out.println("Nope");
  }

if (num == 1 || num == 9) {
  System.out.println("Yep");
  }

Example 2: java not equal to

if(5 != 4) // != means "not equal to"
  	return true;

Example 3: 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

Tags:

Java Example