— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet227/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   223   224   225   226   227   228   229   230   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

%
java Of76
5 class Acts
7 class Clowns
7 class Of76
Output
interface
Nose {
public int iMethod( ) ;
}
abstract class Picasso implements 
Nose 

public int iMethod( ) {
return 7;
}
}
class 
Clowns extends Picasso
{ }
class 
Acts extends Picasso
{
public int iMethod( ) {
return 5;
}
}
puzzle 
solution


this is a new chapter
235
9

constructors and 
garbage collection
Objects are born and objects die. 
You’re in charge of an object’s lifecycle. 
You decide when and how to 
construct 
it. You decide when to 
destroy 
it. Except you don’t 
actually destroy the object yourself, you simply abandon it. But once it’s abandoned, the 
heartless 
Garbage Collector (gc)
can vaporize it, reclaiming the memory that object was 
using. If you’re gonna write Java, you’re gonna create objects. Sooner or later, you’re gonna 
have to let some of them go, or risk running out of RAM. In this chapter we look at how objects 
are created, where they live while they’re alive, and how to keep or abandon them efficiently. 
That means we’ll talk about the heap, the stack, scope, constructors, super constructors, null 
references, and more. Warning: this chapter contains material about object death that some 
may find disturbing. Best not to get too attached.
Life and Death 
of an Object
...then he said, 
“I can’t feel my legs!” and 
I said “Joe! Stay with me Joe!” 
But it was... too late. The garbage 
collector came and... he was gone. 
Best object I ever had. 
Make it Stick



Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   223   224   225   226   227   228   229   230   ...   555




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