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


The three things we’ll write for each class



Download 17,18 Mb.
Pdf ko'rish
bet74/90
Sana22.06.2022
Hajmi17,18 Mb.
#693704
1   ...   70   71   72   73   74   75   76   77   ...   90
Bog'liq
(Head Up) Kathy Sierra Bert Bates - Head First Java, 3rd Edition Early Release-O\'Reilly Media, Inc. (2021)

The three things we’ll write for each class:


This bar is displayed on the next set of pages to tell you which part you’re
working on. For example, if you see this picture at the top of a page, it
means you’re working on prepcode for the SimpleStartup class.
prep code
A form of pseudocode, to help you focus on the logic without stressing
about syntax.
test code
A class or methods that will test the real code and validate that it’s doing the
right thing.
real code
The actual implementation of the class. This is where we write real Java
code.


SimpleStartup class


You’ll get the idea of how prepcode (our version of pseudocode) works as
you read through this example. It’s sort of half-way between real Java code
and a plain English description of the class. Most prepcode includes three
parts: instance variable declarations, method declarations, method logic.
The most important part of prepcode is the method logic, because it defines
what
has to happen, which we later translate into 
how
, when we actually
write the method code.
DECLARE
an 
int array
to hold the location cells. Call it 
locationCells
.
DECLARE
an 
int
to hold the number of hits. Call it 
numOfHits
and 
SET
it
to 0.
DECLARE

checkYourself()
method that takes a 
String
for the user’s
guess (“1”, “3”, etc.), checks it, and returns a result representing a “hit”,
“miss”, or “kill”.
DECLARE

setLocationCells()
setter method that takes an 
int array
(which has the three cell locations as 
ints
(2,3,4, etc.).



Download 17,18 Mb.

Do'stlaringiz bilan baham:
1   ...   70   71   72   73   74   75   76   77   ...   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