Java: Java Programming For Beginners a simple Start To Java Programming (Written By a software Engineer)


Download 0.82 Mb.
Pdf ko'rish
bet21/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   17   18   19   20   21   22   23   24   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

The Relational Operators
Java  also  supports  several  relational  operators.  The  list  of  relational  operators  that  are
supported by Java are given below.


Operation
Operator
Description
Equal To
==
Compares  the  values  of  two
variables for equality
Not Equal To
!=
Compares  the  values  of  two
variables for inequality
Greater Than
>
Checks  if  one  value  is  greater
than the other value
Lesser Than
<
Checks  if  one  value  is  lesser
than the other value
Greater  Than  Or
Equal To
>=
Checks  if  one  value  is  greater
than or equal to the other value
Lesser
Than
Or
Equal To
<=
Checks  if  one  value  is  lesser
than or equal to the other value
The Bitwise Operators
The  bitwise  operators  available  in  Java  can  be  easily  applied  to  a  number  of  data  types.
These  data  types  include  byte,  short,  long,  int  and  char.  Typically,  any  bitwise  operator
performs the concerned operation bit-wise. For instance, if you consider the example of an
integer  x,  which  has  the  value  60.  Therefore,  the  binary  equivalent  of  x  is  00111100.
Consider  another  variable  y,  with  the  value  13  or  00001101.  If  we  perform  the  bitwise
operation & on these two numbers, then you will get the following result:
x&y = 0000 1100
The table shown below shows a list of bitwise operators that are available in Java.
Operation
Operator
Description
BINARY AND
&
Performs the AND operation


BINARY OR
|
Performs the OR operation
BINARY XOR
^
Performs the XOR operation
ONE’S
COMPLEMENT
~
Performs  the  complementation
operation on a unary variable
BINARY
LEFT
SHIFT
<<
Performs the left shifting of bits
BINARY
RIGHT
SHIFT
>>
Performs  the  right  shifting  of
bits
In addition to the above mentioned, Java also supports right shift zero fill operator (>>>),
which fills the shifted bits on the right with zero.

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   17   18   19   20   21   22   23   24   ...   95




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling