Head First Java a brain-Friendly Guide Kathy Sierra and Bert Bates



Download 17,18 Mb.
Pdf ko'rish
bet7/90
Sana22.06.2022
Hajmi17,18 Mb.
#693704
1   2   3   4   5   6   7   8   9   10   ...   90
Bog'liq
(Head Up) Kathy Sierra Bert Bates - Head First Java, 3rd Edition Early Release-O\'Reilly Media, Inc. (2021)

// this line disturbs me
Most white space doesn’t matter.
x = 3 ;
Variables are declared with a 
name
and a 
type
(you’ll learn about all
the Java 
types
 in 
Chapter 3
).
int weight; 
//
type:
int, 
name:
weight
Classes and methods must be defined within a pair of curly braces.
public void go() 
{
// amazing code here 
}


Looping and looping and...
Java has a lot of looping constructs: 
while

do-while
, and 
for,
being the
oldest. You’ll get the full loop scoop later in the book, but not for awhile, so
let’s do 
while
for now.


The syntax (not to mention logic) is so simple you’re probably asleep
already. As long as some condition is true, you do everything inside the
loop 
block
. The loop block is bounded by a pair of curly braces, so
whatever you want to repeat needs to be inside that block.
The key to a loop is the 
conditional test
. In Java, a conditional test is an
expression that results in a 
boolean
value—in other words, something that
is either 
true
or 
false
.
If you say something like, “While 
iceCreamInTheTub is true
, keep
scooping”, you have a clear boolean test. There either 
is
ice cream in the
tub or there 
isn’t
. But if you were to say, “While 
Bob
keep scooping”, you
don’t have a real test. To make that work, you’d have to change it to
something like, “While Bob is snoring...” or “While Bob is 
not
wearing
plaid...”

Download 17,18 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10   ...   90




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