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


do compile, what would be their output?



Download 17,18 Mb.
Pdf ko'rish
bet66/90
Sana22.06.2022
Hajmi17,18 Mb.
#693704
1   ...   62   63   64   65   66   67   68   69   ...   90
Bog'liq
(Head Up) Kathy Sierra Bert Bates - Head First Java, 3rd Edition Early Release-O\'Reilly Media, Inc. (2021)

do compile, what would be their output?
A
class XCopy { 
public static void main(String [] args) { 
int orig = 42; 
XCopy x = new XCopy(); 
int y = x.go(orig); 
System.out.println(orig + “ ” + y); 

int go(int arg) { 
arg = arg * 2; 


return arg; 

}
class Clock { 
String time; 
void setTime(String t) { 
time = t; 

void getTime() { 
return time; 


class ClockTestDrive { 
public static void main(String [] args) { 
Clock c = new Clock(); 
c.setTime(“1245”); 
String tod = c.getTime(); 
System.out.println(“time: ” + tod); 

}
A bunch of Java components, in full costume, are playing a party game,
“Who am I?” They give you a clue, and you try to guess who they are,
based on what they say. Assume they always tell the truth about themselves.
If they happen to say something that could be true for more than one guy,
then write down all for whom that sentence applies. Fill in the blanks next
to the sentence with the names of one or more attendees.


Tonight’s attendees:
instance variable, argument, return, getter, setter, encapsulation,
public, private, pass by value, method
A class can have any number of these.
________________________________
A method can have only one of these.
________________________________
This can be implicitly promoted.
________________________________
I prefer my instance variables private.
________________________________
It really means ‘make a copy’.
________________________________
Only setters should update these.
________________________________

Download 17,18 Mb.

Do'stlaringiz bilan baham:
1   ...   62   63   64   65   66   67   68   69   ...   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