Professional Documents
Culture Documents
Oops I Notes
Oops I Notes
The Boolean legical operabors
Shown here Operake only on beolean operand,
: > Bl of the binasy logical
'
Operators Combine. +tivoboclean Values to form
@ esuleank boolean Volus .
ace
Operarey Resule
Logical AND
Logial OR
Logias Xar (exclusive. oR)
Showt-civeutt OR
be Shor-craftt AnD
Logical Unery NOT
AND axsignmens
OR assignment
XOR assignment
Equal to
Now eanol towy
(Vi) Assignment Operators
Se ee ee
—> ssi gnmant Opesators are Used
to Assign Valuoy toa Variable.
> The lee cide Operand of tha
Assignment Opevatoy js oMocsiable:
ASSignmenk Operakos tg a Vos
SD The sight sre OPperanol of Lhe
Opesabor Rosule
+ Rddicion OF +0 humbes
— Subteraczion of tio numbers
x Multiplication of too Numbers.
Wa Division cf tive husmbers
xy: Modulus a
class Assignments
Public static void main (String arestt)
ieee
String name 5> %
Hum =10;
Tame = “Gopal”
| System. Out printls (“num fs ANH grea.
/ + rum);
System - out *printl( “nome. ig Wi gned
4 ~tneume) ;
3
Ourp ee
Mam is assigned : 10
home is assigned : Gopal
(vis) Bitwise Operators
> Tova deftres several bitwise Operators
thar Con be applied bo the Integer Lyseg
® long
eine
i © shost
1 e char
e bybe |
|
|
Diese opevators ack upon the
individual bis of theiy Operands.Biewise,
Bitwise
OR
Bikustse XoR
Rivwotge
Complement
Bitus Se Shige lee
-- &
YR >
Bicwise
Fb sight
Oia’) Ternary Operakor
—— rv
—e Ternary OPerakor in ya jg
Used a, one bneay weplacamenk fey
if - then-else Statement
> Tr is the only Conditional
Cpesaror hich tals Cheese, operands.
Syntax
Sendition 2 expression] : expressiona
Example
claw Teropre)
q
Punlic Static veid main Ceuring avgst3)
LString result = Cnursber|
Number” 1 “ Nlogavive Nene
System. out» painels Cvesuble) 5
Ine Number = Tb»
w
So)? “Positiy,
4
3
Quepur
Positive Number]
|
ed Contre! Statements
K. _
Le A progtamming language Uses
Contsol Statements to control Eh Flow of
Exrcution of pregram beaed on caxtoin
Conditions -
% Tova Sauppests Ehyee Gbegorieg og
Gsntvo| Statements :
D) Selection Statements
FH) Tkesarion Stakemants
M) Jump. stakemanks
SSContto\ Stakements
Samp sisterents}
(Chile leg) Pelee]
S/S
do while loop a
enneennnee
>[ Nested if else)
Dp Selection Statements
— > Based oh bre Condition Slack
bho Stakement
— > Selection seatement ts also
Called as Gnditional statement
—_—et Stakement
> Coregories of Sdlaction Statement axe
@ iF Statement
© Switch StatementSimple 12 Seakerrank 1S Ehe Most Simpl,
rok 3 Scokemant -
>t is used to decide Whether a
Btakerrant os block of Stakemants
Ce &fecured oF Nok-
\E Ceonditior)
q
Wstolemenks to Cxocute i
M condition % 'Yue.
4&
Exorple
class \or
Oy
Public Static void mein (Serirg owgse J)
4
int a= lo» b=205
Te Case)
4
System - ous - princh (“ats flow gore 70.) 5
3
4
4
Gi) if-else Stakemant
Thre Tova if-else Statemt Abe
bests the Condition:
“STe executes the if bloc iF
Condition ig tue else iF
else block is executed
‘tc
is Falke theSyntax
ECcondici on)
Wexacukes Chis bloc pF
Teondition is
4
else
brite
Texarsures hig bloas Te
if Condatio, ig False
Cap le
Class lay
Public Stati
& Vota, mem (String Sas)
is
tht as lo, b=20;
if Casey
o.
System. Ou primtlny (a ag
3
CNge
L
3
lowaese?, a);
Stem out printin( big
7 we? BY 5
“4‘) s¢-else-if laddexs Stakrement
>The if Statements ave executed From
Aha top down
—> Tova if-else-¥ laddes ig Used
to dacide among yuleiple. options
7 —> The cenditions Controlling the
eis byue) the Stakerrenk associated with
kheb W is oxecuked Ord (rn. Test of Ere
\odder is bypassed -
SIF hone of bho Conditions 3s
Lrur, then the Final elee Statemank will
be executed -Syntax
1 Coon dition)
Statemant
else jig Coondition )
else Tf Condition)“LD
VF (wee = = 1)
L
doy = “Sunday”;
else if (week == 2)
if
dawg =“ Mondow?s
==>
else ie (oe
L
day = “Tuesdox”s
else iF eee’ == »
4 doy