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


int x = 2 + 2 ; …x becomes 4 int



Download 3,91 Mb.
Pdf ko'rish
bet14/70
Sana02.04.2022
Hajmi3,91 Mb.
#524999
1   ...   10   11   12   13   14   15   16   17   ...   70
Bog'liq
Java for Fucking Idiots

int
x =
2
+
2
;
…x becomes 4
int
y =
4
*
9
;
…x becomes 36
But what happens where we start combining our operators? How do we
know which ones are more important and go first? Do we multiply, then
add, then subtract? If only there was some sort of pneumatic device to
remember…
Well, guess what?
PEMDAS
 is back!!
Order of operations
An operation is one little chunk of math shit. Your waiter probably waits on
tables (each one an operation) in a certain order, by the time in you arrived,
how much they like you, how much they expect you to tip, where you’re
located in the restaurant, etc.
Math has its own order of operations: PEMDAS.
P arentheses () -> E xponents
3
-> M ultiplication & D ivision */ -> A
ddition & S ubtraction +-
There is good news! You’re beautiful.
No, but there are no exponents in Java. You literally just need to remember
that stuff in parentheses happens first, followed by multiplying/dividing
things, followed by adding/subtracting.
And if there’s no combination between those categories you just go left to
right.
Trust me, it’s super easy.


Into the examples, here we go!
Example one!
int
x =
5
+
3
-
7
;
x is 1.
Why? No need to worry about the PEMDAS rules, it’s just
addition/subtraction.
5

3
is 
8
. And if we subtract 
7
from that, we get 
1
.
Example two!
int
y =
5
-
7
*
6
;
x is -37.
Why? The multiplication must happen first, because PEMDAS says so.
7

6
is 
42
. And if we subtract from 42 from 5, we get -37.

Download 3,91 Mb.

Do'stlaringiz bilan baham:
1   ...   10   11   12   13   14   15   16   17   ...   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