Java for Fucking Idiots: Learn the Basics of Java Programming Without any experience!



Download 3,91 Mb.
Pdf ko'rish
bet18/70
Sana02.04.2022
Hajmi3,91 Mb.
#524999
1   ...   14   15   16   17   18   19   20   21   ...   70
Bog'liq
Java for Fucking Idiots

boolean
isSameCharacter =
'c'
==
'c'
;
//False
boolean
isSameNumber =
5
==
4
;
The Booleans are back, baby!
Are 
‘c’
and 
‘c’
the same character?
Are 
5
and 
4
the same number?
Those booleans are accordingly set to true or false.
Preeeeettttyyyy easy right? Just don’t panic your little head over all the
equals signs.
Yeah, there’s still an equals sign to assign the value on the right to the
variable on the left. Just like before. But that’s not related to the ==
comparison operator on the right side.
If it really confuses you, use some parentheses.
boolean
isCartEmpty = (numberOfItems ==
0
);
The first one (=) is the assignment operator. The next two (==) form one
comparison operator.
Changing requirements


I changed my mind. I want to check if a variable is not equal to something.
Here, we split our comparison operator == in half, and we’re so shocked by
the gruesome fatality that has befallen our beloved operator, that we put an
exclamation point.
!=
Basically, “not equal to.”
boolean
isGoodCharacter = character.
name
!=
"Brandon Stark"
;
A character is a good one if its name is not equal to Brandon Stark.
boolean
haveGumDropButtons = numGumDropButtons !=
0
;
We have gum drop buttons if the value is not equal to 0.
boolean
fallingWithStyle = flying != true;
We’re not flying, we’re falling. With style.
Two more:
//True
boolean
isDifferentCharacter =
'c'
!=

Download 3,91 Mb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   ...   70




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish